From 5c017d32c8412a20835cbd96e02268579b9eabbe Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:36:11 -0500 Subject: [PATCH 001/128] 23w51b-SNAP 0.20.0-snap --- .gitignore | 1 + build.gradle | 7 +- gradle.properties | 14 +- gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 43462 bytes gradle/wrapper/gradle-wrapper.properties | 2 + gradlew | 282 ++++-- gradlew.bat | 15 +- .../fi/dy/masa/tweakeroo/config/Configs.java | 644 ++++++++---- .../masa/tweakeroo/config/FeatureToggle.java | 360 ++++--- .../MixinClientPlayerInteractionManager.java | 185 ++-- .../masa/tweakeroo/mixin/MixinInGameHud.java | 62 +- .../tweakeroo/mixin/MixinPlayerEntity.java | 42 +- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 212 ++-- .../tweakeroo/tweaks/PlacementTweaks.java | 937 ++++++++---------- .../masa/tweakeroo/util/InventoryUtils.java | 780 ++++++--------- src/main/resources/fabric.mod.json | 4 +- 16 files changed, 1794 insertions(+), 1753 deletions(-) diff --git a/.gitignore b/.gitignore index e4ac6288a..7ef5b896e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ logs/ build.number run .vscode +libs/ diff --git a/build.gradle b/build.gradle index 7b629f148..9d425f681 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,14 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 repositories { - maven { url 'https://masa.dy.fi/maven' } + // maven { url 'https://masa.dy.fi/maven' } + maven { + url 'https://masa.dy.fi/maven' + mavenLocal() + } maven { url 'https://maven.terraformersmc.com/releases/' } // maven { url 'https://maven.quiltmc.org/repository/release/' } + flatDir { dirs 'libs' } } dependencies { diff --git a/gradle.properties b/gradle.properties index 74242f0d4..7296ec127 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.0 +mod_version = 0.20.0-snap # Required malilib version -malilib_version = 0.18.0 +malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.4 -minecraft_version = 1.20.4 -mappings_version = 1.20.4+build.1 +minecraft_version_out = 23w51b +minecraft_version = 23w51b +mappings_version = 23w51b+build.3 -fabric_loader_version = 0.15.1 -mod_menu_version = 9.0.0-pre.1 +fabric_loader_version = 0.15.3 +mod_menu_version = 9.0.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..d64cd4917707c1f8861d8cb53dd15194d4248596 100644 GIT binary patch literal 43462 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 literal 59203 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

K7UpUK$>l@ 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 E2O(~oYXATM diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a59520664..1af9e0930 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c8..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -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,99 @@ # ############################################################################## -## -## 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"` - -# 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"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +119,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,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi 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=SC2039,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=SC2039,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, 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" +# 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: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +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. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 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% @@ -40,7 +41,7 @@ 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/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 9977f79b6..9f01acd65 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -1,10 +1,11 @@ package fi.dy.masa.tweakeroo.config; import java.io.File; + import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import net.minecraft.client.MinecraftClient; + import fi.dy.masa.malilib.config.ConfigUtils; import fi.dy.masa.malilib.config.HudAlignment; import fi.dy.masa.malilib.config.IConfigBase; @@ -29,86 +30,183 @@ import fi.dy.masa.tweakeroo.util.InventoryUtils; import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; import fi.dy.masa.tweakeroo.util.SnapAimMode; +import net.minecraft.client.MinecraftClient; -public class Configs implements IConfigHandler -{ +public class Configs implements IConfigHandler { private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; - public static class Generic - { - public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 8, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 8 for placing, 6 for breaking."); - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); - public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); - public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); - public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); - public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); - public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); - public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); - public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); - public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); - public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); - public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger ("fastLeftClickCount", 10, 1, 64, "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); - public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean ("fastPlacementRememberOrientation", true, "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); - public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger ("fastRightClickCount", 10, 1, 64, "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); - public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger ("fillCloneLimit", 10000000, 1, 1000000000, "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); - public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor ("flexibleBlockPlacementOverlayColor", "#C03030F0", "The color of the currently pointed-at\nregion in block placement the overlay"); - public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble ("flyDecelerationFactor", 0.4, 0.0, 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); - public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble ("flySpeedPreset1", 0.01, 0, 4, "The fly speed for preset 1"); - public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble ("flySpeedPreset2", 0.064, 0, 4, "The fly speed for preset 2"); - public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble ("flySpeedPreset3", 0.128, 0, 4, "The fly speed for preset 3"); - public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble ("flySpeedPreset4", 0.32, 0, 4, "The fly speed for preset 4"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean ("freeCameraPlayerInputs", false, "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); - public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean ("freeCameraPlayerMovement", false, "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); - public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble ("gammaOverrideValue", 16, 0, 32, "The gamma value to use when the override option is enabled"); - public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean ("handRestockPre", true, "If enabled, then hand restocking happens\nbefore the stack runs out"); - public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger ("handRestockPreThreshold", 6, 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); - public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean ("hangableEntityBypassInverse", false, "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); - public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger ("hotbarSlotCycleMax", 2, 1, 9, "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); - public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger ("hotbarSlotRandomizerMax", 5, 1, 9, "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); - public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList ("hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger ("hotbarSwapOverlayOffsetX", 4, "The horizontal offset of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger ("hotbarSwapOverlayOffsetY", 4, "The vertical offset of the hotbar swap overlay"); - public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger ("itemSwapDurabilityThreshold", 20, 5, 10000, "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); - public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean ("itemUsePacketCheckBypass", true, "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); - public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger ("mapPreviewSize", 160, 16, 512, "The size of the rendered map previews"); - public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger ("periodicAttackInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); - public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger ("periodicUseInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger ("periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger ("periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down attack (left click)"); - public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger ("periodicHoldUseDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); - public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger ("periodicHoldUseInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); - public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean ("permanentSneakAllowInGUIs", false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); - public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger ("placementGridSize", 3, 1, 1000, "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger ("placementLimit", 3, 1, 10000, "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList ("placementRestrictionMode", PlacementRestrictionMode.FACE, "The Placement Restriction mode to use (hotkey-selectable)"); - public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean ("placementRestrictionTiedToFast", true, "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); - public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean ("potionWarningBeneficialOnly", true, "Only warn about potion effects running out that are marked as \"beneficial\""); - public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger ("potionWarningThreshold", 600, 1, 1000000, "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); - public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean ("rememberFlexibleFromClick", true, "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); - public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger ("renderLimitItem", -1, -1, 10000, "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger ("renderLimitXPOrb", -1, -1, 10000, "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); - public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true, "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); - public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true, "Whether or not holding shift is required for the Shulker Box preview"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true, "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false, "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); - public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true, "Whether or not to render the snap aim angle indicator"); - public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor ("snapAimIndicatorColor", "#603030FF", "The color for the snap aim indicator background"); - public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList ("snapAimMode", SnapAimMode.YAW, "Snap aim mode: yaw, or pitch, or both"); - public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean ("snapAimOnlyCloseToAngle", true, "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); - public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean ("snapAimPitchOvershoot", false, "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); - public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble ("snapAimPitchStep", 12.5, 0, 90, "The pitch angle step of the snap aim tweak"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble ("snapAimThresholdPitch", 1.5, "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble ("snapAimThresholdYaw", 5.0, "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble ("snapAimYawStep", 45, 0, 360, "The yaw angle step of the snap aim tweak"); - public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger ("structureBlockMaxSize", 128, 1, 256, "The maximum dimensions for a Structure Block's saved area"); - public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString ("toolSwitchableSlots", "1-9", "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); - public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString ("toolSwitchIgnoredSlots", "", "The slots where the Tool Switch tweak does not work when they are active."); - public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean ("zoomAdjustMouseSensitivity", true, "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); - public static final ConfigDouble ZOOM_FOV = new ConfigDouble ("zoomFov", 30, 0.01, 359.99, "The FOV value used for the zoom feature"); + public static class Generic { + public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger("afterClickerClickCount", 1, 1, + 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, 64, + "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, 64, + "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( + "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); + public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, + "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList("breakingRestrictionMode", + PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); + public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", "#80000000", + "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); + public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", + "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); + public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( + "carpetAccuratePlacementProtocol", true, + "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); + public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean("clientPlacementRotation", true, + "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); + public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger("customInventoryGuiScale", 2, + 1, 10, + "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); + public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList("elytraCameraIndicator", + ActiveMode.WITH_KEY, + "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( + "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); + public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger("fastBlockPlacementCount", 2, + 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); + public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean("fastLeftClickAllowTools", + false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); + public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, 64, + "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); + public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( + "fastPlacementRememberOrientation", true, + "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); + public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, 1, 64, + "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); + public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, + 1000000000, + "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); + public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( + "flexibleBlockPlacementOverlayColor", "#C03030F0", + "The color of the currently pointed-at\nregion in block placement the overlay"); + public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", 0.4, 0.0, + 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); + public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, + "The fly speed for preset 1"); + public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, + "The fly speed for preset 2"); + public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, + "The fly speed for preset 3"); + public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, + "The fly speed for preset 4"); + public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean("freeCameraPlayerInputs", false, + "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); + public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean("freeCameraPlayerMovement", + false, + "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); + public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, 32, + "The gamma value to use when the override option is enabled"); + public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, + "If enabled, then hand restocking happens\nbefore the stack runs out"); + public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger("handRestockPreThreshold", 6, + 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); + public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( + "hangableEntityBypassInverse", false, + "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); + public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, 9, + "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); + public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger("hotbarSlotRandomizerMax", 5, + 1, 9, + "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); + public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( + "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger("hotbarSwapOverlayOffsetX", + 4, "The horizontal offset of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger("hotbarSwapOverlayOffsetY", + 4, "The vertical offset of the hotbar swap overlay"); + public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( + "itemSwapDurabilityThreshold", 20, 5, 10000, + "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); + public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean("itemUsePacketCheckBypass", + true, + "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); + public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, + "The size of the rendered map previews"); + public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", 20, 0, + Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); + public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, 0, + Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( + "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( + "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, + "The number of game ticks between starting to hold down attack (left click)"); + public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger("periodicHoldUseDuration", 20, + 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); + public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger("periodicHoldUseInterval", 20, + 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); + public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean("permanentSneakAllowInGUIs", + false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); + public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, 1000, + "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, + "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( + "placementRestrictionMode", PlacementRestrictionMode.FACE, + "The Placement Restriction mode to use (hotkey-selectable)"); + public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( + "placementRestrictionTiedToFast", true, + "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); + public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( + "potionWarningBeneficialOnly", true, + "Only warn about potion effects running out that are marked as \"beneficial\""); + public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", 600, 1, + 1000000, + "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); + public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", true, + "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); + public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, 10000, + "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, 10000, + "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger("sculkSensorPulseLength", 40, 0, + 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); + public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean("shulkerDisplayBgColor", + true, + "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); + public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( + "shulkerDisplayRequireShift", true, + "Whether or not holding shift is required for the Shulker Box preview"); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, + "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean("slotSyncWorkaroundAlways", + false, + "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); + public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, + "Whether or not to render the snap aim angle indicator"); + public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", "#603030FF", + "The color for the snap aim indicator background"); + public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", SnapAimMode.YAW, + "Snap aim mode: yaw, or pitch, or both"); + public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean("snapAimOnlyCloseToAngle", + true, + "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); + public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", false, + "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); + public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, + "The pitch angle step of the snap aim tweak"); + public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", 1.5, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, + "The yaw angle step of the snap aim tweak"); + public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", 128, 1, + 256, "The maximum dimensions for a Structure Block's saved area"); + public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", + "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); + public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", "", + "The slots where the Tool Switch tweak does not work when they are active."); + public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( + "zoomAdjustMouseSensitivity", true, + "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); + public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, + "The FOV value used for the zoom feature"); public static final ImmutableList OPTIONS = ImmutableList.of( CARPET_ACCURATE_PLACEMENT_PROTOCOL, @@ -186,51 +284,114 @@ public static class Generic STRUCTURE_BLOCK_MAX_SIZE, TOOL_SWITCHABLE_SLOTS, TOOL_SWITCH_IGNORED_SLOTS, - ZOOM_FOV - ); + ZOOM_FOV); } - public static class Fixes - { - public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); - public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); - public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean("ravagerClientBlockBreakFix", false, "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); + public static class Fixes { + public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, + "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); + public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, + "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); + public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( + "ravagerClientBlockBreakFix", false, + "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); public static final ImmutableList OPTIONS = ImmutableList.of( ELYTRA_FIX, MAC_HORIZONTAL_SCROLL, - RAVAGER_CLIENT_BLOCK_BREAK_FIX - ); + RAVAGER_CLIENT_BLOCK_BREAK_FIX); } - public static class Lists - { - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList("blockTypeBreakRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Block Type Break Restriction tweak"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList("blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList("blockTypeBreakRestrictionWhiteList", ImmutableList.of(), "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); - public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Entity Type Attack Restriction tweak"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); - public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST, "The item restriction type for the Fast Block Placement tweak"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of(), "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList("fastRightClickBlockListType", ListType.BLACKLIST, "The targeted block restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList("fastRightClickBlockBlackList", ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", "minecraft:white_shulker_box"), "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList("fastRightClickBlockWhiteList", ImmutableList.of(), "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList("fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList("fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList("fastRightClickWhiteList", ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", "minecraft:glass_bottle"), "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); - public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", ImmutableList.of("White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); - public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", ListType.NONE, "The restriction list type for the Hand Restock tweak"); - public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); - public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", ImmutableList.of(), "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); - public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", ListType.NONE, "The list type for potion warning effects"); - public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", "minecraft:slowness", "minecraft:weakness"), "The potion effects that will not be warned about"); - public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), "The only potion effects that will be warned about"); - public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", ImmutableList.of("mainhand", "offhand"), "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); - public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); + public static class Lists { + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "blockTypeBreakRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Block Type Break Restriction tweak"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( + "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), + "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( + "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), + "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); + public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", + ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", + "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", + "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), + "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "entityTypeAttackRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Entity Type Attack Restriction tweak"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( + "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), + "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( + "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), + "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", + ImmutableList.of( + " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", + "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", + "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), + "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); + public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( + "fastPlacementItemListType", ListType.BLACKLIST, + "The item restriction type for the Fast Block Placement tweak"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( + "fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), + "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( + "fastPlacementItemWhiteList", ImmutableList.of(), + "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( + "fastRightClickBlockListType", ListType.BLACKLIST, + "The targeted block restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( + "fastRightClickBlockBlackList", + ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", + "minecraft:white_shulker_box"), + "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( + "fastRightClickBlockWhiteList", ImmutableList.of(), + "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( + "fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( + "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), + "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( + "fastRightClickWhiteList", + ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", + "minecraft:glass_bottle"), + "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); + public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", + ImmutableList.of( + "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", + "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), + "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); + public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", + ListType.NONE, "The restriction list type for the Hand Restock tweak"); + public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", + ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), + "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); + public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", + ImmutableList.of(), + "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); + public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", + ListType.NONE, "The list type for potion warning effects"); + public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", + ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", + "minecraft:slowness", "minecraft:weakness"), + "The potion effects that will not be warned about"); + public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", + ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), + "The only potion effects that will be warned about"); + public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", + ImmutableList.of("mainhand", "offhand"), + "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); + public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", + ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), + "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); public static final ImmutableList OPTIONS = ImmutableList.of( BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, @@ -258,56 +419,114 @@ public static class Lists POTION_WARNING_BLACKLIST, POTION_WARNING_WHITELIST, REPAIR_MODE_SLOTS, - UNSTACKING_ITEMS - ); + UNSTACKING_ITEMS); } - public static class Disable - { - public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed("disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); - public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed("disableAxeStripping", false, "", "Disables stripping logs with an axe"); - public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient ("disableBatSpawning", false, "", "Disables Bat spawning in single player"); - public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed("disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed("disableBlockBreakingParticles", false, "", "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "Disables boss bar rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "Disables all client-side light updates"); - public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); - public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS= new ConfigBooleanHotkeyed("disableCreativeMenuInfestedBlocks", false, "", "Removes infested stone blocks from the creative search inventory"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed("disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed("disableDeadMobTargeting", false, "", "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableEntityRendering", false, "", "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient ("disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed("disableFallingBlockEntityRendering", false, "", "If enabled, then falling block entities won't be rendered at all"); - public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed("disableFirstPersonEffectParticles", false, "", "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); - public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed("disableInventoryEffectRendering", false, "", "Removes the potion effect rendering from the inventory GUIs"); - public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed("disableItemSwitchRenderCooldown", false, "", "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); - public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed("disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); - public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed("disableNauseaEffect", false, "", "Disables the nausea visual effects"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", false, "", "Removes the fog in the Nether"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed("disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); - public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient ("disableObserver", false, "", "Disable Observers from triggering at all"); - public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed("disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); - public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", false, "", "Disables all particles"); - public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed("disablePortalGuiClosing", false, "", "If enabled, then you can still open GUIs while in a Nether Portal"); - public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", false, "", "Disables rain rendering and sounds"); - public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed("disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); - public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed("disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); - public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed("disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); - public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed("disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); - public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed("disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); - public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, "", "Prevent the Sign edit GUI from opening"); - public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", false, "", "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); - public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed("disableSlimeBlockSlowdown", false, "", "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); - public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); + public static class Disable { + public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( + "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); + public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( + "disableAxeStripping", false, "", "Disables stripping logs with an axe"); + public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient("disableBatSpawning", + false, "", "Disables Bat spawning in single player"); + public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( + "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( + "disableBlockBreakingParticles", false, "", + "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( + "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, + "", "Disables boss bar rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, + "", "Removes the fog that boss mobs cause"); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( + "disableChunkRendering", false, "", + "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( + "disableClientEntityUpdates", false, "", + "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( + "disableClientLightUpdates", false, "", "Disables all client-side light updates"); + public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( + "disableConstantChunkSaving", false, "", + "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); + public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( + "disableCreativeMenuInfestedBlocks", false, "", + "Removes infested stone blocks from the creative search inventory"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( + "disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( + "disableDeadMobTargeting", false, "", + "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableEntityRendering", false, "", + "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( + "disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( + "disableFallingBlockEntityRendering", false, "", + "If enabled, then falling block entities won't be rendered at all"); + public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( + "disableFirstPersonEffectParticles", false, "", + "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); + public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( + "disableInventoryEffectRendering", false, "", + "Removes the potion effect rendering from the inventory GUIs"); + public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( + "disableItemSwitchRenderCooldown", false, "", + "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); + public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( + "disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); + public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( + "disableNauseaEffect", false, "", "Disables the nausea visual effects"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", + false, "", "Removes the fog in the Nether"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( + "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); + public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", false, + "", "Disable Observers from triggering at all"); + public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( + "disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); + public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", + false, "", "Disables all particles"); + public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( + "disablePortalGuiClosing", false, "", + "If enabled, then you can still open GUIs while in a Nether Portal"); + public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", + false, "", "Disables rain rendering and sounds"); + public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( + "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); + public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( + "disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); + public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( + "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); + public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( + "disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); + public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( + "disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); + public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, + "", "Prevent the Sign edit GUI from opening"); + public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", + false, "", + "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); + public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( + "disableSlimeBlockSlowdown", false, "", + "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( + "disableStatusEffectHud", false, "", + "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( + "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( + "disableVillagerTradeLocking", false, "", + "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); + public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( + "disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( + "disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); public static final ImmutableList OPTIONS = ImmutableList.of( DISABLE_ARMOR_STAND_RENDERING, @@ -353,50 +572,54 @@ public static class Disable DISABLE_TILE_ENTITY_TICKING, DISABLE_VILLAGER_TRADE_LOCKING, DISABLE_WALL_UNSPRINT, - DISABLE_WORLD_VIEW_BOB - ); + DISABLE_WORLD_VIEW_BOB); } - public static class Internal - { - public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger ("flySpeedPreset", 0, 0, 3, "This is just for the mod internally to track the\ncurrently selected fly speed preset"); - public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble ("gammaValueOriginal", 0, 0, 1, "The original gamma value, before the gamma override was enabled"); - public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger ("hotbarScrollCurrentRow", 3, 0, 3, "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); - public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble ("slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); - public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble ("snapAimLastPitch", 0, -135, 135, "The last snapped-to pitch value"); - public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble ("snapAimLastYaw", 0, 0, 360, "The last snapped-to yaw value"); + public static class Internal { + public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, + "This is just for the mod internally to track the\ncurrently selected fly speed preset"); + public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, + "The original gamma value, before the gamma override was enabled"); + public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger("hotbarScrollCurrentRow", 3, 0, + 3, + "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); + public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( + "slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); + public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, 135, + "The last snapped-to pitch value"); + public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, + "The last snapped-to yaw value"); public static final ImmutableList OPTIONS = ImmutableList.of( FLY_SPEED_PRESET, GAMMA_VALUE_ORIGINAL, HOTBAR_SCROLL_CURRENT_ROW, SLIME_BLOCK_SLIPPERINESS_ORIGINAL, - SNAP_AIM_LAST_YAW - ); + SNAP_AIM_LAST_YAW); } - public static ConfigDouble getActiveFlySpeedConfig() - { - switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) - { - case 0: return Configs.Generic.FLY_SPEED_PRESET_1; - case 1: return Configs.Generic.FLY_SPEED_PRESET_2; - case 2: return Configs.Generic.FLY_SPEED_PRESET_3; - case 3: return Configs.Generic.FLY_SPEED_PRESET_4; - default: return Configs.Generic.FLY_SPEED_PRESET_1; + public static ConfigDouble getActiveFlySpeedConfig() { + switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { + case 0: + return Configs.Generic.FLY_SPEED_PRESET_1; + case 1: + return Configs.Generic.FLY_SPEED_PRESET_2; + case 2: + return Configs.Generic.FLY_SPEED_PRESET_3; + case 3: + return Configs.Generic.FLY_SPEED_PRESET_4; + default: + return Configs.Generic.FLY_SPEED_PRESET_1; } } - public static void loadFromFile() - { + public static void loadFromFile() { File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); - if (configFile.exists() && configFile.isFile() && configFile.canRead()) - { + if (configFile.exists() && configFile.isFile() && configFile.canRead()) { JsonElement element = JsonUtils.parseJsonFile(configFile); - if (element != null && element.isJsonObject()) - { + if (element != null && element.isJsonObject()) { JsonObject root = element.getAsJsonObject(); ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); @@ -410,7 +633,7 @@ public static void loadFromFile() } // TODO 1.19.3+ - //CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); + // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); @@ -418,27 +641,32 @@ public static void loadFromFile() InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION + .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); - PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.HAND_RESTOCK_RESTRICTION + .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( Lists.HAND_RESTOCK_BLACKLIST.getStrings(), Lists.HAND_RESTOCK_WHITELIST.getStrings()); @@ -448,25 +676,25 @@ public static void loadFromFile() Lists.POTION_WARNING_BLACKLIST.getStrings(), Lists.POTION_WARNING_WHITELIST.getStrings()); - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION + .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); - if (MinecraftClient.getInstance().world == null) - { - // Turn off after loading the configs, just in case it was enabled in the config somehow. - // But only if we are currently not in a world, since changing configs also re-loads them when closing the menu. + if (MinecraftClient.getInstance().world == null) { + // Turn off after loading the configs, just in case it was enabled in the config + // somehow. + // But only if we are currently not in a world, since changing configs also + // re-loads them when closing the menu. FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); } } - public static void saveToFile() - { + public static void saveToFile() { File dir = FileUtils.getConfigDirectory(); - if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) - { + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { JsonObject root = new JsonObject(); ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); @@ -482,14 +710,12 @@ public static void saveToFile() } @Override - public void load() - { + public void load() { loadFromFile(); } @Override - public void save() - { + public void save() { saveToFile(); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 6de4ed80a..0bdcc7822 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; + import fi.dy.masa.malilib.config.ConfigType; import fi.dy.masa.malilib.config.IConfigBoolean; import fi.dy.masa.malilib.config.IConfigNotifiable; @@ -16,89 +17,164 @@ import fi.dy.masa.malilib.util.StringUtils; import fi.dy.masa.tweakeroo.Tweakeroo; -public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable -{ - TWEAK_ACCURATE_BLOCK_PLACEMENT ("tweakAccurateBlockPlacement", false, "", "Enables a simpler version of Flexible placement, similar to\nthe Carpet mod, so basically either facing into or out\nfrom the block face clicked on."), - TWEAK_AFTER_CLICKER ("tweakAfterClicker", false, "", KeybindSettings.INGAME_BOTH, "Enables a \"after clicker\" tweak, which does automatic right\nclicks on the just-placed block.\nUseful for example for Repeaters (setting the delay).\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_AIM_LOCK ("tweakAimLock", false, "", "Enables an aim lock, locking the yaw and pitch rotations\nto the current values.\nThis is separate from the snap aim lock,\nwhich locks them to the snapped value.\nThis allows locking them \"freely\" to the current value."), - TWEAK_ANGEL_BLOCK ("tweakAngelBlock", false, "", "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode"), - TWEAK_BLOCK_REACH_OVERRIDE ("tweakBlockReachOverride", false, "", "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"), - TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), - TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), - TWEAK_BREAKING_RESTRICTION ("tweakBreakingRestriction", false, "", "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), - TWEAK_CHAT_BACKGROUND_COLOR ("tweakChatBackgroundColor", false, "", "Overrides the default chat background color\nwith the one from Generics -> 'chatBackgroundColor'"), - TWEAK_CHAT_PERSISTENT_TEXT ("tweakChatPersistentText", false, "", "Stores the text from the chat input text field\nand restores it when the chat is opened again"), - TWEAK_CHAT_TIMESTAMP ("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), - TWEAK_COMMAND_BLOCK_EXTRA_FIELDS("tweakCommandBlockExtraFields", false, "", "Adds extra fields to the Command Block GUI, for settings\nthe name of the command block, and seeing the stats results"), +public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable { + TWEAK_ACCURATE_BLOCK_PLACEMENT("tweakAccurateBlockPlacement", false, "", + "Enables a simpler version of Flexible placement, similar to\nthe Carpet mod, so basically either facing into or out\nfrom the block face clicked on."), + TWEAK_AFTER_CLICKER("tweakAfterClicker", false, "", KeybindSettings.INGAME_BOTH, + "Enables a \"after clicker\" tweak, which does automatic right\nclicks on the just-placed block.\nUseful for example for Repeaters (setting the delay).\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_AIM_LOCK("tweakAimLock", false, "", + "Enables an aim lock, locking the yaw and pitch rotations\nto the current values.\nThis is separate from the snap aim lock,\nwhich locks them to the snapped value.\nThis allows locking them \"freely\" to the current value."), + TWEAK_ANGEL_BLOCK("tweakAngelBlock", false, "", + "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode"), + TWEAK_BLOCK_REACH_OVERRIDE("tweakBlockReachOverride", false, "", + "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"), + TWEAK_ENTITY_REACH_OVERRIDE("tweakEntityReachOverride", false, "", + "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), + TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", + "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), + TWEAK_BREAKING_GRID("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, + "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), + TWEAK_BREAKING_RESTRICTION("tweakBreakingRestriction", false, "", + "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), + TWEAK_CHAT_BACKGROUND_COLOR("tweakChatBackgroundColor", false, "", + "Overrides the default chat background color\nwith the one from Generics -> 'chatBackgroundColor'"), + TWEAK_CHAT_PERSISTENT_TEXT("tweakChatPersistentText", false, "", + "Stores the text from the chat input text field\nand restores it when the chat is opened again"), + TWEAK_CHAT_TIMESTAMP("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), + TWEAK_COMMAND_BLOCK_EXTRA_FIELDS("tweakCommandBlockExtraFields", false, "", + "Adds extra fields to the Command Block GUI, for settings\nthe name of the command block, and seeing the stats results"), // TODO 1.19.3+ - //TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), + // TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds + // custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control + // which items are added to the groups.\nNote: Currently these will be added to + // the Transportation group\n(because it has the elast items), but in the + // future\nthe groups will be configurable per added item"), // TODO/FIXME 1.19+ the mixin needs an access widener now - //TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows adding custom flat world presets to the list.\nThe presets are defined in Lists -> flatWorldPresets"), - TWEAK_CUSTOM_FLY_DECELERATION ("tweakCustomFlyDeceleration", false, "", "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), - TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), - TWEAK_ELYTRA_CAMERA ("tweakElytraCamera", false, "", "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), - TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction",false, "", "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), - TWEAK_SHULKERBOX_STACKING ("tweakEmptyShulkerBoxesStack", false, true, "", "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), - TWEAK_SHULKERBOX_STACK_GROUND ("tweakEmptyShulkerBoxesStackOnGround", false, true, "", "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), - TWEAK_EXPLOSION_REDUCED_PARTICLES ("tweakExplosionReducedParticles", false, "", "If enabled, then all explosion particles will use the\nEXPLOSION_NORMAL particle instead of possibly\nthe EXPLOSION_LARGE or EXPLOSION_HUGE particles"), - TWEAK_F3_CURSOR ("tweakF3Cursor", false, "", "Enables always rendering the F3 screen cursor"), - TWEAK_FAKE_SNEAKING ("tweakFakeSneaking", false, "", "Enables \"fake sneaking\" ie. prevents you from falling from edges\nwithout slowing down the movement speed"), - TWEAK_FAKE_SNEAK_PLACEMENT ("tweakFakeSneakPlacement", false, "", "This tweak offsets the click position to the adjacent air block\nfrom the block that you actually click on.\nThis basically allows you to place blocks against blocks\nthat have a click action, such as opening inventory GUIs,\nwithout having to sneak. Note that this doesn't not actually\nfake sneaking in any way, just the apparent effect is similar."), - TWEAK_FAST_BLOCK_PLACEMENT ("tweakFastBlockPlacement", false, "", "Enables fast/convenient block placement when moving\nthe cursor over new blocks"), - TWEAK_FAST_LEFT_CLICK ("tweakFastLeftClick", false, "", "Enables automatic fast left clicking while holding down\nthe attack button (left click).\nThe number of clicks per tick is set in the Generic configs."), - TWEAK_FAST_RIGHT_CLICK ("tweakFastRightClick", false, "", "Enables automatic fast right clicking while holding down\nthe use button (right click).\nThe number of clicks per tick is set in the Generic configs."), - TWEAK_FILL_CLONE_LIMIT ("tweakFillCloneLimit", false, true, "", "Enables overriding the /fill and /clone command\nblock limits in single player.\nThe new limit can be set in the Generic configs,\nin the 'fillCloneLimit' config value"), - TWEAK_FLY_SPEED ("tweakFlySpeed", false, "", KeybindSettings.INGAME_BOTH, "Enables overriding the fly speed in creative or spectator mode\nand using some presets for it"), - TWEAK_FLEXIBLE_BLOCK_PLACEMENT ("tweakFlexibleBlockPlacement", false, "", "Enables placing blocks in different orientations\nor with an offset, while holding down the\nhotkeys for those modes."), - TWEAK_FREE_CAMERA ("tweakFreeCamera", false, "", "Enables a free camera mode, similar to spectator mode,\nbut where the player will remain in place where\nyou first activate the free camera mode"), - TWEAK_GAMMA_OVERRIDE ("tweakGammaOverride", false, "", "Overrides the video settings gamma value with\nthe one set in the Generic configs"), - TWEAK_HAND_RESTOCK ("tweakHandRestock", false, "", "Enables swapping a new stack to the main or the offhand\nwhen the previous stack runs out"), - TWEAK_HANGABLE_ENTITY_BYPASS ("tweakHangableEntityBypass", false, "", "Allows not targeting hangable entities (Item Frames and Paintings).\nThe Generic -> hangableEntityBypassInverse option can be used to control\nwhether you must be sneaking or not sneaking to be able to target the entity."), - TWEAK_HOLD_ATTACK ("tweakHoldAttack", false, "", "Emulates holding down the attack button"), - TWEAK_HOLD_USE ("tweakHoldUse", false, "", "Emulates holding down the use button"), - TWEAK_HOTBAR_SCROLL ("tweakHotbarScroll", false, "", "Enables the hotbar swapping via scrolling feature"), - TWEAK_HOTBAR_SLOT_CYCLE ("tweakHotbarSlotCycle", false, "", KeybindSettings.INGAME_BOTH, "Enables cycling the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_HOTBAR_SLOT_RANDOMIZER ("tweakHotbarSlotRandomizer", false, "", KeybindSettings.INGAME_BOTH, "Enables randomizing the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_HOTBAR_SWAP ("tweakHotbarSwap", false, "", "Enables the hotbar swapping via hotkeys feature"), - TWEAK_INVENTORY_PREVIEW ("tweakInventoryPreview", false, true, "", "Enables an inventory preview while having the cursor over\na block or an entity with an inventory and holding down\nthe configured hotkey."), - TWEAK_ITEM_UNSTACKING_PROTECTION("tweakItemUnstackingProtection", false, "", "If enabled, then items configured in Lists -> unstackingItems\nwon't be allowed to spill out when using.\nThis is meant for example to prevent throwing buckets\ninto lava when filling them."), - TWEAK_LAVA_VISIBILITY ("tweakLavaVisibility", false, "", "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."), - TWEAK_MAP_PREVIEW ("tweakMapPreview", false, "", "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"), - TWEAK_MOVEMENT_KEYS ("tweakMovementKeysLast", false, "", "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."), - TWEAK_PERIODIC_ATTACK ("tweakPeriodicAttack", false, "", "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"), - TWEAK_PERIODIC_USE ("tweakPeriodicUse", false, "", "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"), - TWEAK_PERIODIC_HOLD_ATTACK ("tweakPeriodicHoldAttack", false, "", "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"), - TWEAK_PERIODIC_HOLD_USE ("tweakPeriodicHoldUse", false, "", "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), - TWEAK_PERMANENT_SNEAK ("tweakPermanentSneak", false, "", "If enabled, the player will be sneaking the entire time"), - TWEAK_PERMANENT_SPRINT ("tweakPermanentSprint", false, "", "If enabled, the player will be always sprinting when moving forward"), - TWEAK_PLACEMENT_GRID ("tweakPlacementGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only place blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_PLACEMENT_LIMIT ("tweakPlacementLimit", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only place a set number\nof blocks per use/right click.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_PLACEMENT_RESTRICTION ("tweakPlacementRestriction", false, "", "Enables the Placement Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal)"), - TWEAK_PLACEMENT_REST_FIRST ("tweakPlacementRestrictionFirst", false, "", "Restricts block placement so that you can only\nplace blocks against the same block type\nyou first clicked on"), - TWEAK_PLACEMENT_REST_HAND ("tweakPlacementRestrictionHand", false, "", "Restricts block placement so that you can only\nplace blocks against the same block type\nyou are holding in your hand"), - TWEAK_PLAYER_INVENTORY_PEEK ("tweakPlayerInventoryPeek", false, "", "Enables a player inventory peek/preview, while holding the\nconfigured hotkey key for it."), - TWEAK_POTION_WARNING ("tweakPotionWarning", false, "", "Prints a warning message to the hotbar when\nnon-ambient potion effects are about to run out"), - TWEAK_PRINT_DEATH_COORDINATES ("tweakPrintDeathCoordinates", false, "", "Enables printing the player's coordinates to chat on death.\nThis feature is originally from usefulmod by nessie."), - TWEAK_PICK_BEFORE_PLACE ("tweakPickBeforePlace", false, "", "If enabled, then before each block placement, the same block\nis switched to hand that you are placing against"), - TWEAK_PLAYER_LIST_ALWAYS_ON ("tweakPlayerListAlwaysVisible", false, "", "If enabled, then the player list is always rendered without\nhaving to hold down the key (tab by default)"), - TWEAK_RENDER_EDGE_CHUNKS ("tweakRenderEdgeChunks", false, "", "Allows the edge-most client-loaded chunks to render.\nVanilla doesn't allow rendering chunks that don't have\nall the adjacent chunks loaded, meaning that the edge-most chunk\nof the client's loaded won't render in vanilla.\n§lThis is also very helpful in the Free Camera mode!§r"), - TWEAK_RENDER_INVISIBLE_ENTITIES ("tweakRenderInvisibleEntities", false, "", "When enabled, invisible entities are rendered like\nthey would be in spectator mode."), - TWEAK_RENDER_LIMIT_ENTITIES ("tweakRenderLimitEntities", false, "", "Enables limiting the number of certain types of entities\nto render per frame. Currently XP Orbs and Item entities\nare supported, see Generic configs for the limits."), - TWEAK_REPAIR_MODE ("tweakRepairMode", false, "", "If enabled, then fully repaired items held in hand will\nbe swapped to damaged items that have Mending on them."), - TWEAK_SCULK_PULSE_LENGTH ("tweakSculkPulseLength", false, true, "", "Allows modifying the Sculk Sensor pulse length. Set the pulse length in Generic -> sculkSensorPulseLength"), - TWEAK_SHULKERBOX_DISPLAY ("tweakShulkerBoxDisplay", false, "", "Enables the Shulker Box contents display when hovering\nover them in an inventory and holding shift"), - TWEAK_SIGN_COPY ("tweakSignCopy", false, "", "When enabled, placed signs will use the text from\nthe previously placed sign.\nCan be combined with tweakNoSignGui to quickly place copies\nof a sign, by enabling that tweak after making the first sign."), - TWEAK_SNAP_AIM ("tweakSnapAim", false, "", KeybindSettings.INGAME_BOTH, "Enabled a snap aim tweak, to make the player face to pre-set exact yaw rotations"), - TWEAK_SNAP_AIM_LOCK ("tweakSnapAimLock", false, "", "Enables a snap aim lock, locking the yaw and/or pitch rotations\nto the currently snapped value"), - TWEAK_SNEAK_1_15_2 ("tweakSneak_1.15.2", false, "", "Restores the 1.15.2 sneaking behavior"), - TWEAK_SPECTATOR_TELEPORT ("tweakSpectatorTeleport", false, "", "Allows spectators to teleport to other spectators.\nThis is originally from usefulmod by nessie."), - TWEAK_STRUCTURE_BLOCK_LIMIT ("tweakStructureBlockLimit", false, true, "", "Allows overriding the structure block limit.\nThe new limit is set in Generic -> structureBlockMaxSize"), - TWEAK_SWAP_ALMOST_BROKEN_TOOLS ("tweakSwapAlmostBrokenTools", false, "", "If enabled, then any damageable items held in the hand that\nare about to break will be swapped to fresh ones"), - TWEAK_TAB_COMPLETE_COORDINATE ("tweakTabCompleteCoordinate", false, "", "If enabled, then tab-completing coordinates while not\nlooking at a block, will use the player's position\ninstead of adding the ~ character."), - TWEAK_TOOL_SWITCH ("tweakToolSwitch", false, "", "Enables automatically switching to an effective tool for the targeted block"), - TWEAK_WEAPON_SWITCH ("tweakWeaponSwitch", false, "", "Enables automatically switching to a weapon for the targeted entity"), - TWEAK_Y_MIRROR ("tweakYMirror", false, "", "Mirrors the targeted y-position within the block bounds.\nThis is basically for placing slabs or stairs\nin the opposite top/bottom state from normal,\nif you have to place them against another slab for example."), - TWEAK_ZOOM ("tweakZoom", false, "", KeybindSettings.INGAME_BOTH, "Enables using the zoom hotkey to, well, zoom in"); + // TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows + // adding custom flat world presets to the list.\nThe presets are defined in + // Lists -> flatWorldPresets"), + TWEAK_CUSTOM_FLY_DECELERATION("tweakCustomFlyDeceleration", false, "", + "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), + TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", + "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), + TWEAK_ELYTRA_CAMERA("tweakElytraCamera", false, "", + "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), + TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction", false, "", + "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), + TWEAK_SHULKERBOX_STACKING("tweakEmptyShulkerBoxesStack", false, true, "", + "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), + TWEAK_SHULKERBOX_STACK_GROUND("tweakEmptyShulkerBoxesStackOnGround", false, true, "", + "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), + TWEAK_EXPLOSION_REDUCED_PARTICLES("tweakExplosionReducedParticles", false, "", + "If enabled, then all explosion particles will use the\nEXPLOSION_NORMAL particle instead of possibly\nthe EXPLOSION_LARGE or EXPLOSION_HUGE particles"), + TWEAK_F3_CURSOR("tweakF3Cursor", false, "", "Enables always rendering the F3 screen cursor"), + TWEAK_FAKE_SNEAKING("tweakFakeSneaking", false, "", + "Enables \"fake sneaking\" ie. prevents you from falling from edges\nwithout slowing down the movement speed"), + TWEAK_FAKE_SNEAK_PLACEMENT("tweakFakeSneakPlacement", false, "", + "This tweak offsets the click position to the adjacent air block\nfrom the block that you actually click on.\nThis basically allows you to place blocks against blocks\nthat have a click action, such as opening inventory GUIs,\nwithout having to sneak. Note that this doesn't not actually\nfake sneaking in any way, just the apparent effect is similar."), + TWEAK_FAST_BLOCK_PLACEMENT("tweakFastBlockPlacement", false, "", + "Enables fast/convenient block placement when moving\nthe cursor over new blocks"), + TWEAK_FAST_LEFT_CLICK("tweakFastLeftClick", false, "", + "Enables automatic fast left clicking while holding down\nthe attack button (left click).\nThe number of clicks per tick is set in the Generic configs."), + TWEAK_FAST_RIGHT_CLICK("tweakFastRightClick", false, "", + "Enables automatic fast right clicking while holding down\nthe use button (right click).\nThe number of clicks per tick is set in the Generic configs."), + TWEAK_FILL_CLONE_LIMIT("tweakFillCloneLimit", false, true, "", + "Enables overriding the /fill and /clone command\nblock limits in single player.\nThe new limit can be set in the Generic configs,\nin the 'fillCloneLimit' config value"), + TWEAK_FLY_SPEED("tweakFlySpeed", false, "", KeybindSettings.INGAME_BOTH, + "Enables overriding the fly speed in creative or spectator mode\nand using some presets for it"), + TWEAK_FLEXIBLE_BLOCK_PLACEMENT("tweakFlexibleBlockPlacement", false, "", + "Enables placing blocks in different orientations\nor with an offset, while holding down the\nhotkeys for those modes."), + TWEAK_FREE_CAMERA("tweakFreeCamera", false, "", + "Enables a free camera mode, similar to spectator mode,\nbut where the player will remain in place where\nyou first activate the free camera mode"), + TWEAK_GAMMA_OVERRIDE("tweakGammaOverride", false, "", + "Overrides the video settings gamma value with\nthe one set in the Generic configs"), + TWEAK_HAND_RESTOCK("tweakHandRestock", false, "", + "Enables swapping a new stack to the main or the offhand\nwhen the previous stack runs out"), + TWEAK_HANGABLE_ENTITY_BYPASS("tweakHangableEntityBypass", false, "", + "Allows not targeting hangable entities (Item Frames and Paintings).\nThe Generic -> hangableEntityBypassInverse option can be used to control\nwhether you must be sneaking or not sneaking to be able to target the entity."), + TWEAK_HOLD_ATTACK("tweakHoldAttack", false, "", "Emulates holding down the attack button"), + TWEAK_HOLD_USE("tweakHoldUse", false, "", "Emulates holding down the use button"), + TWEAK_HOTBAR_SCROLL("tweakHotbarScroll", false, "", "Enables the hotbar swapping via scrolling feature"), + TWEAK_HOTBAR_SLOT_CYCLE("tweakHotbarSlotCycle", false, "", KeybindSettings.INGAME_BOTH, + "Enables cycling the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_HOTBAR_SLOT_RANDOMIZER("tweakHotbarSlotRandomizer", false, "", KeybindSettings.INGAME_BOTH, + "Enables randomizing the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_HOTBAR_SWAP("tweakHotbarSwap", false, "", "Enables the hotbar swapping via hotkeys feature"), + TWEAK_INVENTORY_PREVIEW("tweakInventoryPreview", false, true, "", + "Enables an inventory preview while having the cursor over\na block or an entity with an inventory and holding down\nthe configured hotkey."), + TWEAK_ITEM_UNSTACKING_PROTECTION("tweakItemUnstackingProtection", false, "", + "If enabled, then items configured in Lists -> unstackingItems\nwon't be allowed to spill out when using.\nThis is meant for example to prevent throwing buckets\ninto lava when filling them."), + TWEAK_LAVA_VISIBILITY("tweakLavaVisibility", false, "", + "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."), + TWEAK_MAP_PREVIEW("tweakMapPreview", false, "", + "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"), + TWEAK_MOVEMENT_KEYS("tweakMovementKeysLast", false, "", + "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."), + TWEAK_PERIODIC_ATTACK("tweakPeriodicAttack", false, "", + "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"), + TWEAK_PERIODIC_USE("tweakPeriodicUse", false, "", + "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"), + TWEAK_PERIODIC_HOLD_ATTACK("tweakPeriodicHoldAttack", false, "", + "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"), + TWEAK_PERIODIC_HOLD_USE("tweakPeriodicHoldUse", false, "", + "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), + TWEAK_PERMANENT_SNEAK("tweakPermanentSneak", false, "", "If enabled, the player will be sneaking the entire time"), + TWEAK_PERMANENT_SPRINT("tweakPermanentSprint", false, "", + "If enabled, the player will be always sprinting when moving forward"), + TWEAK_PLACEMENT_GRID("tweakPlacementGrid", false, "", KeybindSettings.INGAME_BOTH, + "When enabled, you can only place blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_PLACEMENT_LIMIT("tweakPlacementLimit", false, "", KeybindSettings.INGAME_BOTH, + "When enabled, you can only place a set number\nof blocks per use/right click.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_PLACEMENT_RESTRICTION("tweakPlacementRestriction", false, "", + "Enables the Placement Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal)"), + TWEAK_PLACEMENT_REST_FIRST("tweakPlacementRestrictionFirst", false, "", + "Restricts block placement so that you can only\nplace blocks against the same block type\nyou first clicked on"), + TWEAK_PLACEMENT_REST_HAND("tweakPlacementRestrictionHand", false, "", + "Restricts block placement so that you can only\nplace blocks against the same block type\nyou are holding in your hand"), + TWEAK_PLAYER_INVENTORY_PEEK("tweakPlayerInventoryPeek", false, "", + "Enables a player inventory peek/preview, while holding the\nconfigured hotkey key for it."), + TWEAK_POTION_WARNING("tweakPotionWarning", false, "", + "Prints a warning message to the hotbar when\nnon-ambient potion effects are about to run out"), + TWEAK_PRINT_DEATH_COORDINATES("tweakPrintDeathCoordinates", false, "", + "Enables printing the player's coordinates to chat on death.\nThis feature is originally from usefulmod by nessie."), + TWEAK_PICK_BEFORE_PLACE("tweakPickBeforePlace", false, "", + "If enabled, then before each block placement, the same block\nis switched to hand that you are placing against"), + TWEAK_PLAYER_LIST_ALWAYS_ON("tweakPlayerListAlwaysVisible", false, "", + "If enabled, then the player list is always rendered without\nhaving to hold down the key (tab by default)"), + TWEAK_RENDER_EDGE_CHUNKS("tweakRenderEdgeChunks", false, "", + "Allows the edge-most client-loaded chunks to render.\nVanilla doesn't allow rendering chunks that don't have\nall the adjacent chunks loaded, meaning that the edge-most chunk\nof the client's loaded won't render in vanilla.\n§lThis is also very helpful in the Free Camera mode!§r"), + TWEAK_RENDER_INVISIBLE_ENTITIES("tweakRenderInvisibleEntities", false, "", + "When enabled, invisible entities are rendered like\nthey would be in spectator mode."), + TWEAK_RENDER_LIMIT_ENTITIES("tweakRenderLimitEntities", false, "", + "Enables limiting the number of certain types of entities\nto render per frame. Currently XP Orbs and Item entities\nare supported, see Generic configs for the limits."), + TWEAK_REPAIR_MODE("tweakRepairMode", false, "", + "If enabled, then fully repaired items held in hand will\nbe swapped to damaged items that have Mending on them."), + TWEAK_SCULK_PULSE_LENGTH("tweakSculkPulseLength", false, true, "", + "Allows modifying the Sculk Sensor pulse length. Set the pulse length in Generic -> sculkSensorPulseLength"), + TWEAK_SHULKERBOX_DISPLAY("tweakShulkerBoxDisplay", false, "", + "Enables the Shulker Box contents display when hovering\nover them in an inventory and holding shift"), + TWEAK_SIGN_COPY("tweakSignCopy", false, "", + "When enabled, placed signs will use the text from\nthe previously placed sign.\nCan be combined with tweakNoSignGui to quickly place copies\nof a sign, by enabling that tweak after making the first sign."), + TWEAK_SNAP_AIM("tweakSnapAim", false, "", KeybindSettings.INGAME_BOTH, + "Enabled a snap aim tweak, to make the player face to pre-set exact yaw rotations"), + TWEAK_SNAP_AIM_LOCK("tweakSnapAimLock", false, "", + "Enables a snap aim lock, locking the yaw and/or pitch rotations\nto the currently snapped value"), + TWEAK_SNEAK_1_15_2("tweakSneak_1.15.2", false, "", "Restores the 1.15.2 sneaking behavior"), + TWEAK_SPECTATOR_TELEPORT("tweakSpectatorTeleport", false, "", + "Allows spectators to teleport to other spectators.\nThis is originally from usefulmod by nessie."), + TWEAK_STRUCTURE_BLOCK_LIMIT("tweakStructureBlockLimit", false, true, "", + "Allows overriding the structure block limit.\nThe new limit is set in Generic -> structureBlockMaxSize"), + TWEAK_SWAP_ALMOST_BROKEN_TOOLS("tweakSwapAlmostBrokenTools", false, "", + "If enabled, then any damageable items held in the hand that\nare about to break will be swapped to fresh ones"), + TWEAK_TAB_COMPLETE_COORDINATE("tweakTabCompleteCoordinate", false, "", + "If enabled, then tab-completing coordinates while not\nlooking at a block, will use the player's position\ninstead of adding the ~ character."), + TWEAK_TOOL_SWITCH("tweakToolSwitch", false, "", + "Enables automatically switching to an effective tool for the targeted block"), + TWEAK_WEAPON_SWITCH("tweakWeaponSwitch", false, "", + "Enables automatically switching to a weapon for the targeted entity"), + TWEAK_Y_MIRROR("tweakYMirror", false, "", + "Mirrors the targeted y-position within the block bounds.\nThis is basically for placing slabs or stairs\nin the opposite top/bottom state from normal,\nif you have to place them against another slab for example."), + TWEAK_ZOOM("tweakZoom", false, "", KeybindSettings.INGAME_BOTH, "Enables using the zoom hotkey to, well, zoom in"); public static final ImmutableList VALUES = ImmutableList.copyOf(values()); @@ -111,38 +187,35 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable callback; - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment) - { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment) { this(name, defaultValue, false, defaultHotkey, KeybindSettings.DEFAULT, comment); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment) - { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment) { this(name, defaultValue, singlePlayer, defaultHotkey, KeybindSettings.DEFAULT, comment); } - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, KeybindSettings settings, String comment) - { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, KeybindSettings settings, String comment) { this(name, defaultValue, false, defaultHotkey, settings, comment); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, KeybindSettings settings, String comment) - { - this(name, defaultValue, singlePlayer, defaultHotkey, settings, comment, StringUtils.splitCamelCase(name.substring(5))); + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, + KeybindSettings settings, String comment) { + this(name, defaultValue, singlePlayer, defaultHotkey, settings, comment, + StringUtils.splitCamelCase(name.substring(5))); } - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName) - { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName) { this(name, defaultValue, false, defaultHotkey, comment, prettyName); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment, String prettyName) - { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment, + String prettyName) { this(name, defaultValue, singlePlayer, defaultHotkey, KeybindSettings.DEFAULT, comment, prettyName); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, KeybindSettings settings, String comment, String prettyName) - { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, + KeybindSettings settings, String comment, String prettyName) { this.name = name; this.valueBoolean = defaultValue; this.defaultValueBoolean = defaultValue; @@ -154,24 +227,21 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable callback) - { + public void setValueChangeCallback(IValueChangeCallback callback) { this.callback = callback; } @Override - public String getComment() - { - String comment = StringUtils.getTranslatedOrFallback("config.comment." + this.getName().toLowerCase(), this.comment); + public String getComment() { + String comment = StringUtils.getTranslatedOrFallback("config.comment." + this.getName().toLowerCase(), + this.comment); - if (comment != null && this.singlePlayer) - { + if (comment != null && this.singlePlayer) { return comment + "\n" + StringUtils.translate("tweakeroo.label.config_comment.single_player_only"); } @@ -230,76 +292,62 @@ public String getComment() } @Override - public IKeybind getKeybind() - { + public IKeybind getKeybind() { return this.keybind; } @Override - public boolean getBooleanValue() - { + public boolean getBooleanValue() { return this.valueBoolean; } @Override - public boolean getDefaultBooleanValue() - { + public boolean getDefaultBooleanValue() { return this.defaultValueBoolean; } @Override - public void setBooleanValue(boolean value) - { + public void setBooleanValue(boolean value) { boolean oldValue = this.valueBoolean; this.valueBoolean = value; - if (oldValue != this.valueBoolean) - { + if (oldValue != this.valueBoolean) { this.onValueChanged(); } } @Override - public boolean isModified() - { + public boolean isModified() { return this.valueBoolean != this.defaultValueBoolean; } @Override - public boolean isModified(String newValue) - { + public boolean isModified(String newValue) { return Boolean.parseBoolean(newValue) != this.defaultValueBoolean; } @Override - public void resetToDefault() - { + public void resetToDefault() { this.valueBoolean = this.defaultValueBoolean; } @Override - public JsonElement getAsJsonElement() - { + public JsonElement getAsJsonElement() { return new JsonPrimitive(this.valueBoolean); } @Override - public void setValueFromJsonElement(JsonElement element) - { - try - { - if (element.isJsonPrimitive()) - { + public void setValueFromJsonElement(JsonElement element) { + try { + if (element.isJsonPrimitive()) { this.valueBoolean = element.getAsBoolean(); + } else { + Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), + element); } - else - { - Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), element); - } - } - catch (Exception e) - { - Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), element, e); + } catch (Exception e) { + Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), + element, e); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 4b970e296..d54d76600 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -10,6 +10,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.tweaks.MiscTweaks; +import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; +import fi.dy.masa.tweakeroo.util.CameraUtils; +import fi.dy.masa.tweakeroo.util.InventoryUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.entity.Entity; @@ -21,110 +26,79 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.tweaks.MiscTweaks; -import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; -import fi.dy.masa.tweakeroo.util.CameraUtils; -import fi.dy.masa.tweakeroo.util.InventoryUtils; - @Mixin(ClientPlayerInteractionManager.class) -public abstract class MixinClientPlayerInteractionManager -{ - @Shadow @Final private MinecraftClient client; +public abstract class MixinClientPlayerInteractionManager { + @Shadow + @Final + private MinecraftClient client; - @Inject(method = "interactItem", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), - cancellable = true) - private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) - { + @Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), cancellable = true) + private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) - { + PlacementTweaks.onProcessRightClickPre(player, hand)) { cir.setReturnValue(ActionResult.PASS); cir.cancel(); } } - @Inject(method = "method_41929", - slice = @Slice(from = @At(value = "INVOKE", - target = "Lnet/minecraft/item/ItemStack;use(" + - "Lnet/minecraft/world/World;" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/TypedActionResult;")), - at = @At("RETURN")) + @Inject(method = "method_41929", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;use(" + + + "Lnet/minecraft/world/World;" + + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/TypedActionResult;")), at = @At("RETURN")) private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, - MutableObject mutableObject, int sequence, - CallbackInfoReturnable> cir) - { + MutableObject mutableObject, int sequence, + CallbackInfoReturnable> cir) { PlacementTweaks.onProcessRightClickPost(playerEntity, hand); } @Inject(method = "interactEntity(" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/entity/Entity;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/ActionResult;", - at = @At("HEAD"), - cancellable = true) - private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) - { + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/entity/Entity;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) + private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, + CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) - { + PlacementTweaks.onProcessRightClickPre(player, hand)) { cir.setReturnValue(ActionResult.PASS); } } @Inject(method = "interactEntityAtLocation(" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/entity/Entity;" + - "Lnet/minecraft/util/hit/EntityHitResult;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/ActionResult;", - at = @At("HEAD"), - cancellable = true) - private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) - { + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/entity/Entity;" + + "Lnet/minecraft/util/hit/EntityHitResult;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) + private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, + CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) - { + PlacementTweaks.onProcessRightClickPre(player, hand)) { cir.setReturnValue(ActionResult.PASS); } } @Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true) - private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) - { - if (CameraUtils.shouldPreventPlayerInputs()) - { + private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) { + if (CameraUtils.shouldPreventPlayerInputs()) { ci.cancel(); - } - else if (FeatureToggle.TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION.getBooleanValue() && - MiscTweaks.isEntityAllowedByAttackingRestriction(target.getType()) == false) - { + } else if (FeatureToggle.TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION.getBooleanValue() && + MiscTweaks.isEntityAllowedByAttackingRestriction(target.getType()) == false) { ci.cancel(); - } - else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) - { + } else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) { InventoryUtils.trySwitchToWeapon(target); } } - @Inject(method = "attackBlock", - slice = @Slice(from = @At(value = "FIELD", ordinal = 0, - target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakingBlock:Z")), - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" + - "Lnet/minecraft/util/math/BlockPos;" + - ")Lnet/minecraft/block/BlockState;", ordinal = 0)) - private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) - { - if (this.client.player != null && this.client.world != null) - { - if (FeatureToggle.TWEAK_TOOL_SWITCH.getBooleanValue()) - { + @Inject(method = "attackBlock", slice = @Slice(from = @At(value = "FIELD", ordinal = 0, target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakingBlock:Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" + + + "Lnet/minecraft/util/math/BlockPos;" + + ")Lnet/minecraft/block/BlockState;", ordinal = 0)) + private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) { + if (this.client.player != null && this.client.world != null) { + if (FeatureToggle.TWEAK_TOOL_SWITCH.getBooleanValue()) { InventoryUtils.trySwitchToEffectiveTool(pos); } @@ -133,56 +107,49 @@ private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnabl } @Inject(method = "attackBlock", at = @At("HEAD"), cancellable = true) - private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) - { + private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) - { + PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) { cir.setReturnValue(false); - } - else - { + } else { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); } } @Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true) // MCP: onPlayerDamageBlock - private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) - { + private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) - { + PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) { cir.setReturnValue(true); - } - else - { + } else { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); } } - @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) - private void overrideReachDistance(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - { - cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); - } - } - - @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) - private void overrideExtendedReach(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - { - cir.setReturnValue(false); - } - } - + // Value moved to PlayerEntity class as getInteractionRange() + /* + * @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) + * private void overrideReachDistance(CallbackInfoReturnable cir) + * { + * if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) + * { + * cir.setReturnValue((float) + * Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + * } + * } + * + * @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) + * private void overrideExtendedReach(CallbackInfoReturnable cir) + * { + * if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) + * { + * cir.setReturnValue(false); + * } + * } + */ @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) - private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) - { + private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { + if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { cir.setReturnValue(false); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index d272f3a88..1971a0621 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo.mixin; -import net.minecraft.scoreboard.ScoreboardDisplaySlot; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -9,76 +8,65 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.renderer.RenderUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.PlayerListHud; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.ScoreboardDisplaySlot; import net.minecraft.scoreboard.ScoreboardObjective; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.renderer.RenderUtils; - @Mixin(InGameHud.class) -public abstract class MixinInGameHud -{ - @Shadow @Final private PlayerListHud playerListHud; - @Shadow @Final private MinecraftClient client; - @Shadow private int scaledWidth; +public abstract class MixinInGameHud { + @Shadow + @Final + private PlayerListHud playerListHud; + @Shadow + @Final + private MinecraftClient client; + // @Shadow private int scaledWidth; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) - private void overridePlayerForRendering(CallbackInfoReturnable cir) - { + private void overridePlayerForRendering(CallbackInfoReturnable cir) { // Fix the hotbar rendering in the Free Camera mode by using the actual player - if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) - { + if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) { cir.setReturnValue(this.client.player); } } - @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) - private void overrideCursorRender(CallbackInfo ci) - { - if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) - { + @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) + private void overrideCursorRender(CallbackInfo ci) { + if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { RenderUtils.renderDirectionsCursor(0, this.client.getTickDelta()); ci.cancel(); } } - @Inject(method = "render", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", - ordinal = 1, shift = At.Shift.AFTER)) - private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) - { - if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) - { + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", ordinal = 1, shift = At.Shift.AFTER)) + private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) { + if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { Scoreboard scoreboard = this.client.world.getScoreboard(); ScoreboardObjective objective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.LIST); this.playerListHud.setVisible(true); - this.playerListHud.render(drawContext, this.scaledWidth, scoreboard, objective); + this.playerListHud.render(drawContext, drawContext.getScaledWindowWidth(), scoreboard, objective); } } @Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true) - private void disableScoreboardRendering(CallbackInfo ci) - { - if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) - { + private void disableScoreboardRendering(CallbackInfo ci) { + if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) { ci.cancel(); } } @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) - private void disableStatusEffectHudRendering(CallbackInfo ci) - { - if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) - { + private void disableStatusEffectHudRendering(CallbackInfo ci) { + if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) { ci.cancel(); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 255261b5c..2ed9955c2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -7,42 +7,50 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; -import fi.dy.masa.tweakeroo.config.FeatureToggle; - @Mixin(PlayerEntity.class) -public abstract class MixinPlayerEntity extends LivingEntity -{ - @Shadow protected abstract boolean clipAtLedge(); +public abstract class MixinPlayerEntity extends LivingEntity { + @Shadow + protected abstract boolean clipAtLedge(); - protected MixinPlayerEntity(EntityType entityType_1, World world_1) - { + protected MixinPlayerEntity(EntityType entityType_1, World world_1) { super(entityType_1, world_1); } @Inject(method = "method_30263", at = @At("HEAD"), cancellable = true) - private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) - { + private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) { + if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) { cir.setReturnValue(this.isOnGround()); } } - @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", - target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) - private boolean fakeSneaking(PlayerEntity entity) - { - if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) - { + @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) + private boolean fakeSneaking(PlayerEntity entity) { + if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) { return true; } return this.clipAtLedge(); } + + @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) + private void overrideBlockReachDistance(CallbackInfoReturnable cir) { + if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { + cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + } + } + + @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) + private void overrideEntityReachDistance(CallbackInfoReturnable cir) { + if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { + cir.setReturnValue((float) Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + } + } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index f71c109e6..54d5907b4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -5,18 +5,9 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; + import javax.annotation.Nullable; -import net.minecraft.block.Block; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.chunk.FlatChunkGeneratorLayer; + import fi.dy.masa.malilib.config.IConfigBoolean; import fi.dy.masa.malilib.config.IConfigInteger; import fi.dy.masa.malilib.gui.Message; @@ -31,103 +22,100 @@ import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; import fi.dy.masa.tweakeroo.util.InventoryUtils; import fi.dy.masa.tweakeroo.util.PotionRestriction; +import net.minecraft.block.Block; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.registry.Registries; +import net.minecraft.util.Identifier; +import net.minecraft.world.gen.chunk.FlatChunkGeneratorLayer; -public class MiscTweaks -{ +public class MiscTweaks { public static final EntityRestriction ENTITY_TYPE_ATTACK_RESTRICTION = new EntityRestriction(); public static final PotionRestriction POTION_RESTRICTION = new PotionRestriction(); - private static final KeybindState KEY_STATE_ATTACK = new KeybindState(MinecraftClient.getInstance().options.attackKey, (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack()); - private static final KeybindState KEY_STATE_USE = new KeybindState(MinecraftClient.getInstance().options.useKey, (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse()); + private static final KeybindState KEY_STATE_ATTACK = new KeybindState( + MinecraftClient.getInstance().options.attackKey, + (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack()); + private static final KeybindState KEY_STATE_USE = new KeybindState(MinecraftClient.getInstance().options.useKey, + (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse()); private static int potionWarningTimer; - private static class KeybindState - { + private static class KeybindState { private final KeyBinding keybind; private final Consumer clickFunc; private boolean state; private int durationCounter; private int intervalCounter; - public KeybindState(KeyBinding keybind, Consumer clickFunc) - { + public KeybindState(KeyBinding keybind, Consumer clickFunc) { this.keybind = keybind; this.clickFunc = clickFunc; } - public void reset() - { + public void reset() { this.state = false; this.intervalCounter = 0; this.durationCounter = 0; } - public void handlePeriodicHold(int interval, int holdDuration, MinecraftClient mc) - { - if (this.state) - { - if (++this.durationCounter >= holdDuration) - { + public void handlePeriodicHold(int interval, int holdDuration, MinecraftClient mc) { + if (this.state) { + if (++this.durationCounter >= holdDuration) { this.setKeyState(false, mc); this.durationCounter = 0; } - } - else if (++this.intervalCounter >= interval) - { + } else if (++this.intervalCounter >= interval) { this.setKeyState(true, mc); this.intervalCounter = 0; this.durationCounter = 0; } } - public void handlePeriodicClick(int interval, MinecraftClient mc) - { - if (++this.intervalCounter >= interval) - { + public void handlePeriodicClick(int interval, MinecraftClient mc) { + if (++this.intervalCounter >= interval) { this.clickFunc.accept(mc); this.intervalCounter = 0; this.durationCounter = 0; } } - private void setKeyState(boolean state, MinecraftClient mc) - { + private void setKeyState(boolean state, MinecraftClient mc) { this.state = state; InputUtil.Key key = InputUtil.fromTranslationKey(this.keybind.getBoundKeyTranslationKey()); KeyBinding.setKeyPressed(key, state); - if (state) - { + if (state) { this.clickFunc.accept(mc); KeyBinding.onKeyPressed(key); } } } - public static void onTick(MinecraftClient mc) - { + public static void onTick(MinecraftClient mc) { ClientPlayerEntity player = mc.player; - if (player == null) - { + if (player == null) { return; } doPeriodicClicks(mc); doPotionWarnings(player); - if (FeatureToggle.TWEAK_REPAIR_MODE.getBooleanValue()) - { + if (FeatureToggle.TWEAK_REPAIR_MODE.getBooleanValue()) { InventoryUtils.repairModeSwapItems(player); } CameraEntity.movementTick(); } - public static void onGameLoop(MinecraftClient mc) - { + public static void onGameLoop(MinecraftClient mc) { PlacementTweaks.onTick(mc); // Reset the counters after rendering each frame @@ -135,10 +123,8 @@ public static void onGameLoop(MinecraftClient mc) Tweakeroo.renderCountXPOrbs = 0; } - private static void doPeriodicClicks(MinecraftClient mc) - { - if (GuiUtils.getCurrentScreen() == null) - { + private static void doPeriodicClicks(MinecraftClient mc) { + if (GuiUtils.getCurrentScreen() == null) { handlePeriodicClicks( KEY_STATE_ATTACK, FeatureToggle.TWEAK_PERIODIC_HOLD_ATTACK, @@ -154,9 +140,7 @@ private static void doPeriodicClicks(MinecraftClient mc) Configs.Generic.PERIODIC_HOLD_USE_INTERVAL, Configs.Generic.PERIODIC_HOLD_USE_DURATION, Configs.Generic.PERIODIC_USE_INTERVAL, mc); - } - else - { + } else { KEY_STATE_ATTACK.reset(); KEY_STATE_USE.reset(); } @@ -169,54 +153,41 @@ private static void handlePeriodicClicks( IConfigInteger cfgHoldClickInterval, IConfigInteger cfgHoldDuration, IConfigInteger cfgClickInterval, - MinecraftClient mc) - { - if (cfgPeriodicHold.getBooleanValue()) - { + MinecraftClient mc) { + if (cfgPeriodicHold.getBooleanValue()) { int interval = cfgHoldClickInterval.getIntegerValue(); int holdDuration = cfgHoldDuration.getIntegerValue(); keyState.handlePeriodicHold(interval, holdDuration, mc); - } - else if (cfgPeriodicClick.getBooleanValue()) - { + } else if (cfgPeriodicClick.getBooleanValue()) { int interval = cfgClickInterval.getIntegerValue(); keyState.handlePeriodicClick(interval, mc); - } - else - { + } else { keyState.reset(); } } - private static void doPotionWarnings(PlayerEntity player) - { + private static void doPotionWarnings(PlayerEntity player) { if (FeatureToggle.TWEAK_POTION_WARNING.getBooleanValue() && - ++potionWarningTimer >= 100) - { + ++potionWarningTimer >= 100) { potionWarningTimer = 0; Collection effects = player.getStatusEffects(); - if (effects.isEmpty() == false) - { + if (effects.isEmpty() == false) { int minDuration = -1; int count = 0; - for (StatusEffectInstance effectInstance : effects) - { - if (potionWarningShouldInclude(effectInstance)) - { + for (StatusEffectInstance effectInstance : effects) { + if (potionWarningShouldInclude(effectInstance)) { ++count; - if (effectInstance.getDuration() < minDuration || minDuration < 0) - { + if (effectInstance.getDuration() < minDuration || minDuration < 0) { minDuration = effectInstance.getDuration(); } } } - if (count > 0) - { + if (count > 0) { InfoUtils.printActionbarMessage("tweakeroo.message.potion_effects_running_out", Integer.valueOf(count), Integer.valueOf(minDuration / 20)); } @@ -224,18 +195,15 @@ private static void doPotionWarnings(PlayerEntity player) } } - public static boolean isEntityAllowedByAttackingRestriction(EntityType type) - { - if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) - { - MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN.getOptionListValue(); + public static boolean isEntityAllowedByAttackingRestriction(EntityType type) { + if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) { + MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN + .getOptionListValue(); - if (messageOutputType == MessageOutputType.MESSAGE) - { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, "tweakeroo.message.warning.entity_type_attack_restriction"); - } - else if (messageOutputType == MessageOutputType.ACTIONBAR) - { + if (messageOutputType == MessageOutputType.MESSAGE) { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, + "tweakeroo.message.warning.entity_type_attack_restriction"); + } else if (messageOutputType == MessageOutputType.ACTIONBAR) { InfoUtils.printActionbarMessage("tweakeroo.message.warning.entity_type_attack_restriction"); } @@ -245,31 +213,27 @@ else if (messageOutputType == MessageOutputType.ACTIONBAR) return true; } - - private static boolean potionWarningShouldInclude(StatusEffectInstance effect) - { + private static boolean potionWarningShouldInclude(StatusEffectInstance effect) { return effect.isAmbient() == false && - (effect.getEffectType().isBeneficial() || - Configs.Generic.POTION_WARNING_BENEFICIAL_ONLY.getBooleanValue() == false) && - effect.getDuration() <= Configs.Generic.POTION_WARNING_THRESHOLD.getIntegerValue() && - POTION_RESTRICTION.isAllowed(effect.getEffectType()); + (effect.getEffectType().value().isBeneficial() || + Configs.Generic.POTION_WARNING_BENEFICIAL_ONLY.getBooleanValue() == false) + && + effect.getDuration() <= Configs.Generic.POTION_WARNING_THRESHOLD.getIntegerValue() && + POTION_RESTRICTION.isAllowed(effect.getEffectType().value()); } @Nullable - public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) - { + public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) { List list = new ArrayList<>(); String[] strings = blockString.split(","); final int count = strings.length; int thicknessSum = 0; - for (int i = 0; i < count; ++i) - { + for (int i = 0; i < count; ++i) { String str = strings[i]; FlatChunkGeneratorLayer layer = parseLayerString(str, thicknessSum); - if (layer == null) - { + if (layer == null) { list = Collections.emptyList(); break; } @@ -282,25 +246,18 @@ public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) } @Nullable - private static FlatChunkGeneratorLayer parseLayerString(String string, int startY) - { + private static FlatChunkGeneratorLayer parseLayerString(String string, int startY) { String[] strings = string.split("\\*", 2); int thickness; - if (strings.length == 2) - { - try - { + if (strings.length == 2) { + try { thickness = Math.max(Integer.parseInt(strings[0]), 0); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { Tweakeroo.logger.error("Error while parsing flat world string => {}", e.getMessage()); return null; } - } - else - { + } else { thickness = 1; } @@ -308,40 +265,31 @@ private static FlatChunkGeneratorLayer parseLayerString(String string, int start int finalThickness = endY - startY; Block block; - try - { + try { block = getBlockFromName(strings[strings.length - 1]); - } - catch (Exception e) - { + } catch (Exception e) { Tweakeroo.logger.error("Error while parsing flat world string => {}", e.getMessage()); return null; } - if (block == null) - { - Tweakeroo.logger.error("Error while parsing flat world string => Unknown block, {}", strings[strings.length - 1]); + if (block == null) { + Tweakeroo.logger.error("Error while parsing flat world string => Unknown block, {}", + strings[strings.length - 1]); return null; - } - else - { + } else { FlatChunkGeneratorLayer layer = new FlatChunkGeneratorLayer(finalThickness, block); // FIXME 1.17 is this just not needed anymore? - //layer.setStartY(startY); + // layer.setStartY(startY); return layer; } } @Nullable - private static Block getBlockFromName(String name) - { - try - { + private static Block getBlockFromName(String name) { + try { Identifier identifier = new Identifier(name); return Registries.BLOCK.getOrEmpty(identifier).orElse(null); - } - catch (Exception e) - { + } catch (Exception e) { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 0cc87f61a..fc7727c94 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -2,6 +2,23 @@ import javax.annotation.Nullable; +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.BlockUtils; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.malilib.util.InfoUtils; +import fi.dy.masa.malilib.util.MessageOutputType; +import fi.dy.masa.malilib.util.PositionUtils; +import fi.dy.masa.malilib.util.PositionUtils.HitPart; +import fi.dy.masa.malilib.util.restrictions.BlockRestriction; +import fi.dy.masa.malilib.util.restrictions.ItemRestriction; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.config.Hotkeys; +import fi.dy.masa.tweakeroo.util.CameraUtils; +import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; +import fi.dy.masa.tweakeroo.util.InventoryUtils; +import fi.dy.masa.tweakeroo.util.MiscUtils; +import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -33,26 +50,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.BlockUtils; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.malilib.util.InfoUtils; -import fi.dy.masa.malilib.util.MessageOutputType; -import fi.dy.masa.malilib.util.PositionUtils; -import fi.dy.masa.malilib.util.PositionUtils.HitPart; -import fi.dy.masa.malilib.util.restrictions.BlockRestriction; -import fi.dy.masa.malilib.util.restrictions.ItemRestriction; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.config.Hotkeys; -import fi.dy.masa.tweakeroo.util.CameraUtils; -import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; -import fi.dy.masa.tweakeroo.util.InventoryUtils; -import fi.dy.masa.tweakeroo.util.MiscUtils; -import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; - -public class PlacementTweaks -{ +public class PlacementTweaks { private static BlockPos posFirst = null; private static BlockPos posFirstBreaking = null; private static BlockPos posLast = null; @@ -71,95 +69,85 @@ public class PlacementTweaks private static int placementCount; private static int hotbarSlot = -1; private static ItemStack stackClickedOn = ItemStack.EMPTY; - @Nullable private static BlockState stateClickedOn = null; + @Nullable + private static BlockState stateClickedOn = null; public static final BlockRestriction BLOCK_TYPE_BREAK_RESTRICTION = new BlockRestriction(); public static final BlockRestriction FAST_RIGHT_CLICK_BLOCK_RESTRICTION = new BlockRestriction(); public static final ItemRestriction FAST_RIGHT_CLICK_ITEM_RESTRICTION = new ItemRestriction(); public static final ItemRestriction FAST_PLACEMENT_ITEM_RESTRICTION = new ItemRestriction(); public static final ItemRestriction HAND_RESTOCK_RESTRICTION = new ItemRestriction(); - public static void onTick(MinecraftClient mc) - { + public static void onTick(MinecraftClient mc) { boolean attack = mc.options.attackKey.isPressed(); boolean use = mc.options.useKey.isPressed(); - if (GuiUtils.getCurrentScreen() == null) - { - if (use) - { + if (GuiUtils.getCurrentScreen() == null) { + if (use) { onUsingTick(); } - if (attack) - { + if (attack) { onAttackTick(mc); } - } - else - { + } else { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } - if (use == false) - { + if (use == false) { clearClickedBlockInfoUse(); - // Clear the cached stack when releasing both keys, so that the restock doesn't happen when + // Clear the cached stack when releasing both keys, so that the restock doesn't + // happen when // using another item or an empty hand. - if (attack == false) - { + if (attack == false) { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } } - if (attack == false) - { + if (attack == false) { clearClickedBlockInfoAttack(); } } - public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) - { + public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) - { - if (isEmulatedClick == false) - { - //System.out.printf("onProcessRightClickPre storing stack: %s\n", stackOriginal); + stackOriginal.isEmpty() == false && + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { + if (isEmulatedClick == false) { + // System.out.printf("onProcessRightClickPre storing stack: %s\n", + // stackOriginal); cacheStackInHand(hand); } - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is + // on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.preRestockHand(player, hand, allowHotbar); } return InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player); } - public static void onProcessRightClickPost(PlayerEntity player, Hand hand) - { - //System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); + public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { + // System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, + // current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } - public static void onLeftClickMousePre() - { + public static void onLeftClickMousePre() { MinecraftClient mc = MinecraftClient.getInstance(); HitResult trace = mc.crosshairTarget; // Only set the position if it was null, otherwise the fast left click tweak // would just reset it every time. - if (trace != null && trace.getType() == HitResult.Type.BLOCK && posFirstBreaking == null) - { + if (trace != null && trace.getType() == HitResult.Type.BLOCK && posFirstBreaking == null) { posFirstBreaking = ((BlockHitResult) trace).getBlockPos(); sideFirstBreaking = ((BlockHitResult) trace).getSide(); } @@ -167,75 +155,64 @@ public static void onLeftClickMousePre() onProcessRightClickPre(mc.player, Hand.MAIN_HAND); } - public static void onLeftClickMousePost() - { - onProcessRightClickPost(MinecraftClient.getInstance().player, Hand.MAIN_HAND); + public static void onLeftClickMousePost() { + MinecraftClient mc = MinecraftClient.getInstance(); + onProcessRightClickPost(mc.player, Hand.MAIN_HAND); } - public static void cacheStackInHand(Hand hand) - { - PlayerEntity player = MinecraftClient.getInstance().player; + public static void cacheStackInHand(Hand hand) { + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerEntity player = mc.player; ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) - { + stackOriginal.isEmpty() == false && + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { stackBeforeUse[hand.ordinal()] = stackOriginal.copy(); hotbarSlot = player.getInventory().selectedSlot; } } - private static void onAttackTick(MinecraftClient mc) - { - if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) - { + private static void onAttackTick(MinecraftClient mc) { + if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { if (mc.player.getAbilities().creativeMode || - (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) - { + (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() + || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) { final int count = Configs.Generic.FAST_LEFT_CLICK_COUNT.getIntegerValue(); - for (int i = 0; i < count; ++i) - { + for (int i = 0; i < count; ++i) { isEmulatedClick = true; ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack(); isEmulatedClick = false; } } - } - else - { + } else { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); Hand hand = Hand.MAIN_HAND; tryRestockHand(mc.player, hand, stackBeforeUse[hand.ordinal()]); } } - private static void onUsingTick() - { + private static void onUsingTick() { MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.player == null) - { + if (mc.player == null) { return; } if (posFirst != null && FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() && - canUseItemWithRestriction(FAST_PLACEMENT_ITEM_RESTRICTION, mc.player)) - { + canUseItemWithRestriction(FAST_PLACEMENT_ITEM_RESTRICTION, mc.player)) { ClientPlayerEntity player = mc.player; World world = player.getEntityWorld(); - final double reach = mc.interactionManager.getReachDistance(); + final double reach = mc.player.getBlockInteractionRange(); final int maxCount = Configs.Generic.FAST_BLOCK_PLACEMENT_COUNT.getIntegerValue(); mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); - for (int i = 0; i < maxCount; ++i) - { + for (int i = 0; i < maxCount; ++i) { HitResult trace = mc.crosshairTarget; - if (trace == null || trace.getType() != HitResult.Type.BLOCK) - { + if (trace == null || trace.getType() != HitResult.Type.BLOCK) { break; } @@ -251,55 +228,46 @@ private static void onUsingTick() ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); if (hand != null && - posNew.equals(posLast) == false && - canPlaceBlockIntoPosition(world, posNew, ctx) && - isPositionAllowedByPlacementRestriction(posNew, side) && - canPlaceBlockAgainst(world, pos, player, hand) - ) - { + posNew.equals(posLast) == false && + canPlaceBlockIntoPosition(world, posNew, ctx) && + isPositionAllowedByPlacementRestriction(posNew, side) && + canPlaceBlockAgainst(world, pos, player, hand)) { /* - IBlockState state = world.getBlockState(pos); - float x = (float) (trace.hitVec.x - pos.getX()); - float y = (float) (trace.hitVec.y - pos.getY()); - float z = (float) (trace.hitVec.z - pos.getZ()); - - if (state.getBlock().onBlockActivated(world, posNew, state, player, hand, side, x, y, z)) - { - return; - } - */ + * IBlockState state = world.getBlockState(pos); + * float x = (float) (trace.hitVec.x - pos.getX()); + * float y = (float) (trace.hitVec.y - pos.getY()); + * float z = (float) (trace.hitVec.z - pos.getZ()); + * + * if (state.getBlock().onBlockActivated(world, posNew, state, player, hand, + * side, x, y, z)) + * { + * return; + * } + */ hitVec = hitVecFirst.add(posNew.getX(), posNew.getY(), posNew.getZ()); ActionResult result = tryPlaceBlock(mc.interactionManager, player, mc.world, posNew, sideFirst, sideRotatedFirst, playerYawFirst, hitVec, hand, hitPartFirst, false); - if (result == ActionResult.SUCCESS) - { + if (result == ActionResult.SUCCESS) { posLast = posNew; mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); - } - else - { + } else { break; } - } - else - { + } else { break; } } // Reset the timer to prevent the regular process method from re-firing ((IMinecraftClientInvoker) mc).tweakeroo_setItemUseCooldown(4); - } - else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && + } else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && mc.options.useKey.isPressed() && - canUseFastRightClick(mc.player)) - { + canUseFastRightClick(mc.player)) { final int count = Configs.Generic.FAST_RIGHT_CLICK_COUNT.getIntegerValue(); - for (int i = 0; i < count; ++i) - { + for (int i = 0; i < count; ++i) { isEmulatedClick = true; ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse(); isEmulatedClick = false; @@ -312,10 +280,8 @@ public static ActionResult onProcessRightClickBlock( ClientPlayerEntity player, ClientWorld world, Hand hand, - BlockHitResult hitResult) - { - if (CameraUtils.shouldPreventPlayerInputs()) - { + BlockHitResult hitResult) { + if (CameraUtils.shouldPreventPlayerInputs()) { return ActionResult.PASS; } @@ -325,21 +291,20 @@ public static ActionResult onProcessRightClickBlock( BlockPos posIn = hitResult.getBlockPos(); if (Configs.Disable.DISABLE_AXE_STRIPPING.getBooleanValue() && - stackPre.getItem() instanceof AxeItem && - MiscUtils.isStrippableLog(world, posIn)) - { + stackPre.getItem() instanceof AxeItem && + MiscUtils.isStrippableLog(world, posIn)) { return ActionResult.PASS; } if (Configs.Disable.DISABLE_SHOVEL_PATHING.getBooleanValue() && - stackPre.getItem() instanceof ShovelItem && - MiscUtils.isShovelPathConvertableBlock(world, posIn)) - { + stackPre.getItem() instanceof ShovelItem && + MiscUtils.isShovelPathConvertableBlock(world, posIn)) { return ActionResult.PASS; } stackPre = stackPre.copy(); - boolean restricted = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() || FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); + boolean restricted = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() + || FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); Direction sideIn = hitResult.getSide(); Vec3d hitVec = hitResult.getPos(); Direction playerFacingH = player.getHorizontalFacing(); @@ -349,24 +314,23 @@ public static ActionResult onProcessRightClickBlock( cacheStackInHand(hand); - if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue() && stateClickedOn == null) - { + if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue() && stateClickedOn == null) { BlockState state = world.getBlockState(posIn); stackClickedOn = state.getBlock().getPickStack(world, posIn, state); stateClickedOn = state; } - if (canPlaceBlockAgainst(world, posIn, player, hand) == false) - { + if (canPlaceBlockAgainst(world, posIn, player, hand) == false) { return ActionResult.PASS; } - //System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); - ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); + // System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, + // hitVec: %s\n", posIn, sideIn, hitPart, hitVec); + ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, + hitPart, true); // Store the initial click data for the fast placement mode - if (posFirst == null && result == ActionResult.SUCCESS && restricted) - { + if (posFirst == null && result == ActionResult.SUCCESS && restricted) { boolean flexible = FeatureToggle.TWEAK_FLEXIBLE_BLOCK_PLACEMENT.getBooleanValue(); boolean accurate = FeatureToggle.TWEAK_ACCURATE_BLOCK_PLACEMENT.getBooleanValue(); boolean rotation = Hotkeys.FLEXIBLE_BLOCK_PLACEMENT_ROTATION.getKeybind().isKeybindHeld(); @@ -387,7 +351,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - //System.out.printf("plop store @ %s\n", posFirst); + // System.out.printf("plop store @ %s\n", posFirst); } return result; @@ -404,8 +368,7 @@ private static ActionResult tryPlaceBlock( Vec3d hitVec, Hand hand, HitPart hitPart, - boolean isFirstClick) - { + boolean isFirstClick) { Direction side = sideIn; boolean handleFlexible = false; BlockPos posNew = null; @@ -418,35 +381,33 @@ private static ActionResult tryPlaceBlock( boolean offset = offsetHeld || (rememberFlexible && firstWasOffset); ItemStack stack = player.getStackInHand(hand); - if (flexible) - { + if (flexible) { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - posNew = isFirstClick && (rotation || offset || adjacent) ? getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx) : posIn; + posNew = isFirstClick && (rotation || offset || adjacent) + ? getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx) + : posIn; // Place the block into the adjacent position - if (adjacent && hitPart != null && hitPart != HitPart.CENTER) - { + if (adjacent && hitPart != null && hitPart != HitPart.CENTER) { posNew = posNew.offset(sideRotatedIn.getOpposite()).offset(sideIn.getOpposite()); - hitVec = hitVec.add(Vec3d.of(sideRotatedIn.getOpposite().getVector().add(sideIn.getOpposite().getVector()))); + hitVec = hitVec + .add(Vec3d.of(sideRotatedIn.getOpposite().getVector().add(sideIn.getOpposite().getVector()))); handleFlexible = true; } - // Place the block facing/against the adjacent block (= just rotated from normal) - if (rotation) - { + // Place the block facing/against the adjacent block (= just rotated from + // normal) + if (rotation) { side = sideRotatedIn; handleFlexible = true; - } - else - { + } else { // Don't rotate the player facing in handleFlexibleBlockPlacement() hitPart = null; } // Place the block into the diagonal position - if (offset) - { + if (offset) { posNew = posNew.offset(sideRotatedIn.getOpposite()); hitVec = hitVec.add(Vec3d.of(sideRotatedIn.getOpposite().getVector())); handleFlexible = true; @@ -456,9 +417,8 @@ private static ActionResult tryPlaceBlock( boolean simpleOffset = false; if (handleFlexible == false && - FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && - stack.getItem() instanceof BlockItem) - { + FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && + stack.getItem() instanceof BlockItem) { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); posNew = getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx); @@ -470,43 +430,35 @@ private static ActionResult tryPlaceBlock( boolean accurateReverse = Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); boolean afterClicker = FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue(); - if (accurate && (accurateIn || accurateReverse || afterClicker)) - { + if (accurate && (accurateIn || accurateReverse || afterClicker)) { Direction facing = side; boolean handleAccurate = false; - if (posNew == null) - { - if (flexible == false || isFirstClick == false) - { + if (posNew == null) { + if (flexible == false || isFirstClick == false) { posNew = posIn; - } - else - { + } else { BlockHitResult hitResult = new BlockHitResult(hitVec, side, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); posNew = getPlacementPositionForTargetedPosition(world, posIn, side, ctx); } } - if (accurateIn) - { + if (accurateIn) { facing = sideIn; hitPart = null; handleAccurate = true; - // Pistons, Droppers, Dispensers should face into the block, but Observers should point their back/output + // Pistons, Droppers, Dispensers should face into the block, but Observers + // should point their back/output // side into the block when the Accurate Placement In hotkey is used - if ((stack.getItem() instanceof BlockItem) == false || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) - { + if ((stack.getItem() instanceof BlockItem) == false + || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) { facing = facing.getOpposite(); } - //System.out.printf("accurate - IN - facing: %s\n", facing); - } - else if (flexible == false || rotation == false) - { - if (stack.getItem() instanceof BlockItem) - { + // System.out.printf("accurate - IN - facing: %s\n", facing); + } else if (flexible == false || rotation == false) { + if (stack.getItem() instanceof BlockItem) { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posNew, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); @@ -520,30 +472,27 @@ else if (flexible == false || rotation == false) BlockState state = item.getBlock().getPlacementState(ctx); // getStateForPlacement can return null in 1.13+ - if (state == null) - { + if (state == null) { return ActionResult.PASS; } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - //System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); + // System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: + // %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, + // player), posNew); - if (facingTmp != null) - { + if (facingTmp != null) { facing = facingTmp; } - } - else - { + } else { facing = player.getHorizontalFacing(); } } - if (accurateReverse) - { - //System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); - if (accurateIn || flexible == false || rotation == false) - { + if (accurateReverse) { + // System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", + // facing, facing.getOpposite()); + if (accurateIn || flexible == false || rotation == false) { facing = facing.getOpposite(); } @@ -551,89 +500,80 @@ else if (flexible == false || rotation == false) handleAccurate = true; } - if ((handleAccurate || afterClicker) && Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue()) - { + if ((handleAccurate || afterClicker) + && Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue()) { // Carpet-Extra mod accurate block placement protocol support double relX = hitVec.x - posNew.getX(); double x = hitVec.x; - int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); + int afterClickerClickCount = MathHelper + .clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); - if (handleAccurate && isFacingValidFor(facing, stack)) - { + if (handleAccurate && isFacingValidFor(facing, stack)) { x = posNew.getX() + relX + 2 + (facing.getId() * 2); } - if (afterClicker) - { + if (afterClicker) { x += afterClickerClickCount * 16; } - //System.out.printf("accurate - pre hitVec: %s\n", hitVec); - //System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); + // System.out.printf("accurate - pre hitVec: %s\n", hitVec); + // System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: + // %s, side: %s\n", facing, x, pos, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - //System.out.printf("accurate - post hitVec: %s\n", hitVec); + // System.out.printf("accurate - post hitVec: %s\n", hitVec); } - //System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); + // System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", + // facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } - if (handleFlexible) - { + if (handleFlexible) { BlockHitResult hitResult = new BlockHitResult(hitVec, side, posNew, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - if (canPlaceBlockIntoPosition(world, posNew, ctx)) - { - //System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posNew, side, hitPart, hitVec); - return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); - } - else - { + if (canPlaceBlockIntoPosition(world, posNew, ctx)) { + // System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: + // %s\n", posNew, side, hitPart, hitVec); + return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, + hitPart); + } else { return ActionResult.PASS; } } - if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) - { - return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, null); + if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) { + return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, + null); } - return processRightClickBlockWrapper(controller, player, world, simpleOffset ? posNew : posIn, sideIn, hitVec, hand); + return processRightClickBlockWrapper(controller, player, world, simpleOffset ? posNew : posIn, sideIn, hitVec, + hand); } - private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEntity player, Hand hand) - { - if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue()) - { + private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEntity player, Hand hand) { + if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue()) { BlockState state = world.getBlockState(pos); - if (stackClickedOn.isEmpty() == false) - { + if (stackClickedOn.isEmpty() == false) { ItemStack stack = state.getBlock().getPickStack(world, pos, state); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) - { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) { return false; } - } - else - { - if (state != stateClickedOn) - { + } else { + if (state != stateClickedOn) { return false; } } } - if (FeatureToggle.TWEAK_PLACEMENT_REST_HAND.getBooleanValue()) - { + if (FeatureToggle.TWEAK_PLACEMENT_REST_HAND.getBooleanValue()) { BlockState state = world.getBlockState(pos); ItemStack stackClicked = state.getBlock().getPickStack(world, pos, state); ItemStack stackHand = player.getStackInHand(hand); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) - { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) { return false; } } @@ -641,34 +581,28 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt return true; } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, Hand hand, PlayerEntity player) - { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, Hand hand, PlayerEntity player) { ItemStack stack = player.getStackInHand(hand); return canUseItemWithRestriction(restriction, stack); } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, ItemStack stack) - { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, ItemStack stack) { return stack.isEmpty() || restriction.isAllowed(stack.getItem()); } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, PlayerEntity player) - { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, PlayerEntity player) { return canUseItemWithRestriction(restriction, Hand.MAIN_HAND, player) && - canUseItemWithRestriction(restriction, Hand.OFF_HAND, player); + canUseItemWithRestriction(restriction, Hand.OFF_HAND, player); } - private static boolean canUseFastRightClick(PlayerEntity player) - { - if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) - { + private static boolean canUseFastRightClick(PlayerEntity player) { + if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) { return false; } HitResult trace = player.raycast(6, 0f, false); - if (trace == null || trace.getType() != HitResult.Type.BLOCK) - { + if (trace == null || trace.getType() != HitResult.Type.BLOCK) { return FAST_RIGHT_CLICK_BLOCK_RESTRICTION.isAllowed(Blocks.AIR); } @@ -677,19 +611,17 @@ private static boolean canUseFastRightClick(PlayerEntity player) return FAST_RIGHT_CLICK_BLOCK_RESTRICTION.isAllowed(block); } - public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stackOriginal) - { + public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stackOriginal) { if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) - { + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { ItemStack stackCurrent = player.getStackInHand(hand); if (stackOriginal.isEmpty() == false && player.getInventory().selectedSlot == hotbarSlot && - (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) - { - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on + (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) { + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is + // on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.restockNewStackToHand(player, hand, stackOriginal, allowHotbar); } } @@ -702,23 +634,24 @@ private static ActionResult processRightClickBlockWrapper( BlockPos posIn, Direction sideIn, Vec3d hitVecIn, - Hand hand) - { - //System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); + Hand hand) { + // System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, + // hand: %s\n", pos, side, hand); if (FeatureToggle.TWEAK_PLACEMENT_LIMIT.getBooleanValue() && - placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) - { + placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) { return ActionResult.PASS; } - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is + // on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.preRestockHand(player, hand, allowHotbar); // We need to grab the stack here if the cached stack is still empty, - // because this code runs before the cached stack gets set on the first click/use. + // because this code runs before the cached stack gets set on the first + // click/use. BlockHitResult hitResult = new BlockHitResult(hitVecIn, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); BlockPos posPlacement = getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx); @@ -727,33 +660,31 @@ private static ActionResult processRightClickBlockWrapper( ItemStack stackOriginal; if (stackBeforeUse[hand.ordinal()].isEmpty() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false) - { + FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false) { stackOriginal = stackBeforeUse[hand.ordinal()]; - } - else - { + } else { stackOriginal = player.getStackInHand(hand).copy(); } if (FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() && - state.canReplace(ctx) == false && state.isReplaceable()) - { + state.canReplace(ctx) == false && state.isReplaceable()) { // If the block itself says it's not replaceable, but the material is (fluids), // then we need to offset the position back, otherwise the check in ItemBlock // will offset the position by one forward from the desired position. - // FIXME This will break if the block behind the desired position is replaceable though... >_> + // FIXME This will break if the block behind the desired position is replaceable + // though... >_> posIn = posIn.offset(sideIn.getOpposite()); } - if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) - { - //System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); + if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) { + // System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", + // pos, side); return ActionResult.PASS; } - final int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); + final int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), + 0, 32); Direction facing = sideIn; boolean flexible = FeatureToggle.TWEAK_FLEXIBLE_BLOCK_PLACEMENT.getBooleanValue(); @@ -761,100 +692,90 @@ private static ActionResult processRightClickBlockWrapper( boolean rememberFlexible = Configs.Generic.REMEMBER_FLEXIBLE.getBooleanValue(); boolean rotation = rotationHeld || (rememberFlexible && firstWasRotation); boolean accurate = FeatureToggle.TWEAK_ACCURATE_BLOCK_PLACEMENT.getBooleanValue(); - boolean keys = Hotkeys.ACCURATE_BLOCK_PLACEMENT_IN.getKeybind().isKeybindHeld() || Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); + boolean keys = Hotkeys.ACCURATE_BLOCK_PLACEMENT_IN.getKeybind().isKeybindHeld() + || Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); accurate = accurate && keys; // Carpet-Extra mod accurate block placement protocol support if (flexible && rotation && accurate == false && - Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && - isFacingValidFor(facing, stackOriginal)) - { + Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && + isFacingValidFor(facing, stackOriginal)) { facing = facing.getOpposite(); // go from block face to click on to the requested facing - //double relX = hitVecIn.x - posIn.getX(); - //double x = posIn.getX() + relX + 2 + (facing.getId() * 2); + // double relX = hitVecIn.x - posIn.getX(); + // double x = posIn.getX() + relX + 2 + (facing.getId() * 2); double x = posIn.getX() + 2 + (facing.getId() * 2); - if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue()) - { + if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue()) { x += afterClickerClickCount * 16; } - //System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); + // System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, + // pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } - if (FeatureToggle.TWEAK_Y_MIRROR.getBooleanValue() && Hotkeys.PLACEMENT_Y_MIRROR.getKeybind().isKeybindHeld()) - { + if (FeatureToggle.TWEAK_Y_MIRROR.getBooleanValue() && Hotkeys.PLACEMENT_Y_MIRROR.getKeybind().isKeybindHeld()) { double y = 1 - hitVecIn.y + 2 * posIn.getY(); // = 1 - (hitVec.y - pos.getY()) + pos.getY(); hitVecIn = new Vec3d(hitVecIn.x, y, hitVecIn.z); - if (sideIn.getAxis() == Direction.Axis.Y) - { + if (sideIn.getAxis() == Direction.Axis.Y) { posIn = posIn.offset(sideIn); sideIn = sideIn.getOpposite(); } } - if (FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue()) - { + if (FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue()) { InventoryUtils.switchToPickedBlock(); } InventoryUtils.trySwapCurrentToolIfNearlyBroken(); - //System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); + // System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: + // %s\n", pos, side, hitVec); ActionResult result; - if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) - { + if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) { result = ActionResult.PASS; - } - else - { - //System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); + } else { + // System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: + // %s\n", pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posIn, false); result = controller.interactBlock(player, hand, context); } - if (result == ActionResult.SUCCESS) - { + if (result == ActionResult.SUCCESS) { placementCount++; } // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - //System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); + // System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, + // current: %s\n", stackOriginal, player.getHeldItem(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && - Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() == false && - world.getBlockState(posPlacement) != stateBefore) - { - for (int i = 0; i < afterClickerClickCount; i++) - { - //System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); + Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() == false && + world.getBlockState(posPlacement) != stateBefore) { + for (int i = 0; i < afterClickerClickCount; i++) { + // System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, + // pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posPlacement, false); result = controller.interactBlock(player, hand, context); } } - if (result == ActionResult.SUCCESS) - { + if (result == ActionResult.SUCCESS) { PlayerInventory inv = player.getInventory(); - if (FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue()) - { + if (FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue()) { int newSlot = inv.selectedSlot + 1; - if (newSlot >= 9 || newSlot >= Configs.Generic.HOTBAR_SLOT_CYCLE_MAX.getIntegerValue()) - { + if (newSlot >= 9 || newSlot >= Configs.Generic.HOTBAR_SLOT_CYCLE_MAX.getIntegerValue()) { newSlot = 0; } inv.selectedSlot = newSlot; - } - else if (FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue()) - { + } else if (FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue()) { int newSlot = player.getRandom().nextInt(Configs.Generic.HOTBAR_SLOT_RANDOMIZER_MAX.getIntegerValue()); inv.selectedSlot = newSlot; } @@ -872,21 +793,15 @@ private static ActionResult handleFlexibleBlockPlacement( float playerYaw, Vec3d hitVec, Hand hand, - @Nullable HitPart hitPart) - { + @Nullable HitPart hitPart) { Direction facing = Direction.fromHorizontal(MathHelper.floor((playerYaw * 4.0F / 360.0F) + 0.5D) & 3); float yawOrig = player.getYaw(); - if (hitPart == HitPart.CENTER) - { + if (hitPart == HitPart.CENTER) { facing = facing.getOpposite(); - } - else if (hitPart == HitPart.LEFT) - { + } else if (hitPart == HitPart.LEFT) { facing = facing.rotateYCounterclockwise(); - } - else if (hitPart == HitPart.RIGHT) - { + } else if (hitPart == HitPart.RIGHT) { facing = facing.rotateYClockwise(); } @@ -895,7 +810,8 @@ else if (hitPart == HitPart.RIGHT) player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - //System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); + // System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing + // orig: %s facing new: %s\n", pos, side, facingOrig, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); @@ -904,8 +820,7 @@ else if (hitPart == HitPart.RIGHT) return result; } - private static void clearClickedBlockInfoUse() - { + private static void clearClickedBlockInfoUse() { posFirst = null; hitPartFirst = null; hitVecFirst = null; @@ -919,75 +834,76 @@ private static void clearClickedBlockInfoUse() stateClickedOn = null; } - private static void clearClickedBlockInfoAttack() - { + private static void clearClickedBlockInfoAttack() { posFirstBreaking = null; sideFirstBreaking = null; } - private static Direction getRotatedFacing(Direction originalSide, Direction playerFacingH, HitPart hitPart) - { - if (originalSide.getAxis().isVertical()) - { - switch (hitPart) - { - case LEFT: return playerFacingH.rotateYClockwise(); - case RIGHT: return playerFacingH.rotateYCounterclockwise(); - case BOTTOM: return originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); - case TOP: return originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); - case CENTER: return originalSide.getOpposite(); - default: return originalSide; + private static Direction getRotatedFacing(Direction originalSide, Direction playerFacingH, HitPart hitPart) { + if (originalSide.getAxis().isVertical()) { + switch (hitPart) { + case LEFT: + return playerFacingH.rotateYClockwise(); + case RIGHT: + return playerFacingH.rotateYCounterclockwise(); + case BOTTOM: + return originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); + case TOP: + return originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); + case CENTER: + return originalSide.getOpposite(); + default: + return originalSide; } - } - else - { - switch (hitPart) - { - case LEFT: return originalSide.rotateYCounterclockwise(); - case RIGHT: return originalSide.rotateYClockwise(); - case BOTTOM: return Direction.UP; - case TOP: return Direction.DOWN; - case CENTER: return originalSide.getOpposite(); - default: return originalSide; + } else { + switch (hitPart) { + case LEFT: + return originalSide.rotateYCounterclockwise(); + case RIGHT: + return originalSide.rotateYClockwise(); + case BOTTOM: + return Direction.UP; + case TOP: + return Direction.DOWN; + case CENTER: + return originalSide.getOpposite(); + default: + return originalSide; } } } - private static boolean isPositionAllowedByPlacementRestriction(BlockPos pos, Direction side) - { + private static boolean isPositionAllowedByPlacementRestriction(BlockPos pos, Direction side) { boolean restrictionEnabled = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue(); boolean gridEnabled = FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); - if (restrictionEnabled == false && gridEnabled == false) - { + if (restrictionEnabled == false && gridEnabled == false) { return true; } int gridSize = Configs.Generic.PLACEMENT_GRID_SIZE.getIntegerValue(); - PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.PLACEMENT_RESTRICTION_MODE.getOptionListValue(); + PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.PLACEMENT_RESTRICTION_MODE + .getOptionListValue(); - return isPositionAllowedByRestrictions(pos, side, posFirst, sideFirst, restrictionEnabled, mode, gridEnabled, gridSize); + return isPositionAllowedByRestrictions(pos, side, posFirst, sideFirst, restrictionEnabled, mode, gridEnabled, + gridSize); } - public static boolean isPositionAllowedByBreakingRestriction(BlockPos pos, Direction side) - { + public static boolean isPositionAllowedByBreakingRestriction(BlockPos pos, Direction side) { MinecraftClient mc = MinecraftClient.getInstance(); World world = mc.world; - if (world != null && FeatureToggle.TWEAK_BLOCK_TYPE_BREAK_RESTRICTION.getBooleanValue()) - { + if (world != null && FeatureToggle.TWEAK_BLOCK_TYPE_BREAK_RESTRICTION.getBooleanValue()) { BlockState state = world.getBlockState(pos); - if (BLOCK_TYPE_BREAK_RESTRICTION.isAllowed(state.getBlock()) == false) - { - MessageOutputType type = (MessageOutputType) Configs.Generic.BLOCK_TYPE_BREAK_RESTRICTION_WARN.getOptionListValue(); + if (BLOCK_TYPE_BREAK_RESTRICTION.isAllowed(state.getBlock()) == false) { + MessageOutputType type = (MessageOutputType) Configs.Generic.BLOCK_TYPE_BREAK_RESTRICTION_WARN + .getOptionListValue(); - if (type == MessageOutputType.MESSAGE) - { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, "tweakeroo.message.warning.block_type_break_restriction"); - } - else if (type == MessageOutputType.ACTIONBAR) - { + if (type == MessageOutputType.MESSAGE) { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, + "tweakeroo.message.warning.block_type_break_restriction"); + } else if (type == MessageOutputType.ACTIONBAR) { InfoUtils.printActionbarMessage("tweakeroo.message.warning.block_type_break_restriction"); } @@ -998,62 +914,60 @@ else if (type == MessageOutputType.ACTIONBAR) boolean restrictionEnabled = FeatureToggle.TWEAK_BREAKING_RESTRICTION.getBooleanValue(); boolean gridEnabled = FeatureToggle.TWEAK_BREAKING_GRID.getBooleanValue(); - if (restrictionEnabled == false && gridEnabled == false) - { + if (restrictionEnabled == false && gridEnabled == false) { return true; } int gridSize = Configs.Generic.BREAKING_GRID_SIZE.getIntegerValue(); - PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.BREAKING_RESTRICTION_MODE.getOptionListValue(); + PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.BREAKING_RESTRICTION_MODE + .getOptionListValue(); - return posFirstBreaking == null || isPositionAllowedByRestrictions(pos, side, posFirstBreaking, sideFirstBreaking, restrictionEnabled, mode, gridEnabled, gridSize); + return posFirstBreaking == null || isPositionAllowedByRestrictions(pos, side, posFirstBreaking, + sideFirstBreaking, restrictionEnabled, mode, gridEnabled, gridSize); } private static boolean isPositionAllowedByRestrictions(BlockPos pos, Direction side, - BlockPos posFirst, Direction sideFirst, boolean restrictionEnabled, PlacementRestrictionMode mode, boolean gridEnabled, int gridSize) - { - if (gridEnabled) - { + BlockPos posFirst, Direction sideFirst, boolean restrictionEnabled, PlacementRestrictionMode mode, + boolean gridEnabled, int gridSize) { + if (gridEnabled) { if ((Math.abs(pos.getX() - posFirst.getX()) % gridSize) != 0 || - (Math.abs(pos.getY() - posFirst.getY()) % gridSize) != 0 || - (Math.abs(pos.getZ() - posFirst.getZ()) % gridSize) != 0) - { + (Math.abs(pos.getY() - posFirst.getY()) % gridSize) != 0 || + (Math.abs(pos.getZ() - posFirst.getZ()) % gridSize) != 0) { return false; } } - if (restrictionEnabled) - { - switch (mode) - { - case COLUMN: return isNewPositionValidForColumnMode(pos, posFirst, sideFirst); - case DIAGONAL: return isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); - case FACE: return isNewPositionValidForFaceMode(pos, side, sideFirst); - case LAYER: return isNewPositionValidForLayerMode(pos, posFirst, sideFirst); - case LINE: return isNewPositionValidForLineMode(pos, posFirst, sideFirst); - case PLANE: return isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); - default: return true; + if (restrictionEnabled) { + switch (mode) { + case COLUMN: + return isNewPositionValidForColumnMode(pos, posFirst, sideFirst); + case DIAGONAL: + return isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); + case FACE: + return isNewPositionValidForFaceMode(pos, side, sideFirst); + case LAYER: + return isNewPositionValidForLayerMode(pos, posFirst, sideFirst); + case LINE: + return isNewPositionValidForLineMode(pos, posFirst, sideFirst); + case PLANE: + return isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); + default: + return true; } - } - else - { + } else { return true; } } - private static boolean isFacingValidFor(Direction facing, ItemStack stack) - { + private static boolean isFacingValidFor(Direction facing, ItemStack stack) { Item item = stack.getItem(); - if (stack.isEmpty() == false && item instanceof BlockItem) - { + if (stack.isEmpty() == false && item instanceof BlockItem) { Block block = ((BlockItem) item).getBlock(); BlockState state = block.getDefaultState(); - for (Property prop : state.getProperties()) - { - if (prop instanceof DirectionProperty) - { + for (Property prop : state.getProperties()) { + if (prop instanceof DirectionProperty) { return ((DirectionProperty) prop).getValues().contains(facing); } } @@ -1062,87 +976,92 @@ private static boolean isFacingValidFor(Direction facing, ItemStack stack) return false; } - private static BlockPos getPlacementPositionForTargetedPosition(World world, BlockPos pos, Direction side, ItemPlacementContext useContext) - { - if (canPlaceBlockIntoPosition(world, pos, useContext)) - { + private static BlockPos getPlacementPositionForTargetedPosition(World world, BlockPos pos, Direction side, + ItemPlacementContext useContext) { + if (canPlaceBlockIntoPosition(world, pos, useContext)) { return pos; } return pos.offset(side); } - private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) - { + private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) { BlockState state = world.getBlockState(pos); + // boolean isLiquid = state.settings.liquid aka state.liquid -- no call for this + // exists return state.canReplace(useContext) || state.isLiquid() || state.isReplaceable(); } - private static boolean isNewPositionValidForColumnMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) - { + private static boolean isNewPositionValidForColumnMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) - { - case X: return posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); - case Y: return posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); - case Z: return posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); + switch (axis) { + case X: + return posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); + case Y: + return posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); + case Z: + return posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); default: return false; } } - private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) - { + private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { Direction.Axis axis = sideFirst.getAxis(); BlockPos relativePos = posNew.subtract(posFirst); - switch (axis) - { - case X: return posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); - case Y: return posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); - case Z: return posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); + switch (axis) { + case X: + return posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); + case Y: + return posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); + case Z: + return posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); default: return false; } } - private static boolean isNewPositionValidForFaceMode(BlockPos posNew, Direction side, Direction sideFirst) - { + private static boolean isNewPositionValidForFaceMode(BlockPos posNew, Direction side, Direction sideFirst) { return side == sideFirst; } - private static boolean isNewPositionValidForLayerMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) - { + private static boolean isNewPositionValidForLayerMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { return posNew.getY() == posFirst.getY(); } - private static boolean isNewPositionValidForLineMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) - { + private static boolean isNewPositionValidForLineMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) - { - case X: return posNew.getX() == posFirst.getX() && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); - case Y: return posNew.getY() == posFirst.getY() && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); - case Z: return posNew.getZ() == posFirst.getZ() && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); + switch (axis) { + case X: + return posNew.getX() == posFirst.getX() + && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); + case Y: + return posNew.getY() == posFirst.getY() + && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); + case Z: + return posNew.getZ() == posFirst.getZ() + && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); default: return false; } } - private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) - { + private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) - { - case X: return posNew.getX() == posFirst.getX(); - case Y: return posNew.getY() == posFirst.getY(); - case Z: return posNew.getZ() == posFirst.getZ(); + switch (axis) { + case X: + return posNew.getX() == posFirst.getX(); + case Y: + return posNew.getY() == posFirst.getY(); + case Z: + return posNew.getZ() == posFirst.getZ(); default: return false; @@ -1150,84 +1069,86 @@ private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos } /* - @Nullable - private static Direction getPlayerMovementDirection(PlayerEntitySP player) - { - double dx = player.posX - playerPosLast.x; - double dy = player.posY - playerPosLast.y; - double dz = player.posZ - playerPosLast.z; - double ax = Math.abs(dx); - double ay = Math.abs(dy); - double az = Math.abs(dz); - - if (Math.max(Math.max(ax, az), ay) < 0.001) - { - return null; - } - - if (ax > az) - { - if (ax > ay) - { - return dx > 0 ? Direction.EAST : Direction.WEST; - } - else - { - return dy > 0 ? Direction.UP : Direction.DOWN; - } - } - else - { - if (az > ay) - { - return dz > 0 ? Direction.SOUTH : Direction.NORTH; - } - else - { - return dy > 0 ? Direction.UP : Direction.DOWN; - } - } - } - - @Nullable - private static Hand getHandWithItem(ItemStack stack, PlayerEntitySP player) - { - if (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemMainhand(), stackFirst)) - { - return Hand.MAIN; - } - - if (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemOffhand(), stackFirst)) - { - return Hand.OFF; - } - - return null; - } - */ - - public static boolean shouldSkipSlotSync(int slotNumber, ItemStack newStack) - { + * @Nullable + * private static Direction getPlayerMovementDirection(PlayerEntitySP player) + * { + * double dx = player.posX - playerPosLast.x; + * double dy = player.posY - playerPosLast.y; + * double dz = player.posZ - playerPosLast.z; + * double ax = Math.abs(dx); + * double ay = Math.abs(dy); + * double az = Math.abs(dz); + * + * if (Math.max(Math.max(ax, az), ay) < 0.001) + * { + * return null; + * } + * + * if (ax > az) + * { + * if (ax > ay) + * { + * return dx > 0 ? Direction.EAST : Direction.WEST; + * } + * else + * { + * return dy > 0 ? Direction.UP : Direction.DOWN; + * } + * } + * else + * { + * if (az > ay) + * { + * return dz > 0 ? Direction.SOUTH : Direction.NORTH; + * } + * else + * { + * return dy > 0 ? Direction.UP : Direction.DOWN; + * } + * } + * } + * + * @Nullable + * private static Hand getHandWithItem(ItemStack stack, PlayerEntitySP player) + * { + * if + * (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemMainhand(), + * stackFirst)) + * { + * return Hand.MAIN; + * } + * + * if + * (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemOffhand(), + * stackFirst)) + * { + * return Hand.OFF; + * } + * + * return null; + * } + */ + + public static boolean shouldSkipSlotSync(int slotNumber, ItemStack newStack) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; ScreenHandler container = player != null ? player.currentScreenHandler : null; + if (player == null) + return false; if (Configs.Generic.SLOT_SYNC_WORKAROUND.getBooleanValue() && - FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue() == false && - container != null && container == player.playerScreenHandler && - (slotNumber == 45 || (slotNumber - 36) == player.getInventory().selectedSlot)) - { + FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue() == false && + container != null && container == player.playerScreenHandler && + (slotNumber == 45 || (slotNumber - 36) == player.getInventory().selectedSlot)) { if (mc.options.useKey.isPressed() && - (Configs.Generic.SLOT_SYNC_WORKAROUND_ALWAYS.getBooleanValue() || - FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() || - FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue())) - { + (Configs.Generic.SLOT_SYNC_WORKAROUND_ALWAYS.getBooleanValue() || + FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() || + FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue())) { return true; } if (mc.options.attackKey.isPressed() && - FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) - { + FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { return true; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d894630e6..0bdda5847 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -9,8 +9,17 @@ import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.annotation.Nullable; +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.Constants; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.malilib.util.InfoUtils; +import fi.dy.masa.tweakeroo.Tweakeroo; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.enchantment.EnchantmentHelper; @@ -44,17 +53,7 @@ import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.Constants; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.malilib.util.InfoUtils; -import fi.dy.masa.tweakeroo.Tweakeroo; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; - -public class InventoryUtils -{ +public class InventoryUtils { private static final List REPAIR_MODE_SLOTS = new ArrayList<>(); private static final List REPAIR_MODE_SLOT_NUMBERS = new ArrayList<>(); private static final HashSet UNSTACKING_ITEMS = new HashSet<>(); @@ -62,134 +61,118 @@ public class InventoryUtils private static final List TOOL_SWITCH_IGNORED_SLOTS = new ArrayList<>(); private static final HashMap, HashSet> WEAPON_MAPPING = new HashMap<>(); - public static void setToolSwitchableSlots(String configStr) - { + public static void setToolSwitchableSlots(String configStr) { parseSlotsFromString(configStr, TOOL_SWITCHABLE_SLOTS); } - public static void setToolSwitchIgnoreSlots(String configStr) - { + public static void setToolSwitchIgnoreSlots(String configStr) { parseSlotsFromString(configStr, TOOL_SWITCH_IGNORED_SLOTS); } - public static void parseSlotsFromString(String configStr, Collection output) - { + public static void parseSlotsFromString(String configStr, Collection output) { String[] parts = configStr.split(","); Pattern patternRange = Pattern.compile("^(?[0-9])-(?[0-9])$"); output.clear(); - if (configStr.isBlank()) - { + if (configStr.isBlank()) { return; } - for (String str : parts) - { - try - { + for (String str : parts) { + try { Matcher matcher = patternRange.matcher(str); - if (matcher.matches()) - { + if (matcher.matches()) { int slotStart = Integer.parseInt(matcher.group("start")) - 1; int slotEnd = Integer.parseInt(matcher.group("end")) - 1; if (slotStart <= slotEnd && - PlayerInventory.isValidHotbarIndex(slotStart) && - PlayerInventory.isValidHotbarIndex(slotEnd)) - { - for (int slotNum = slotStart; slotNum <= slotEnd; ++slotNum) - { - if (output.contains(slotNum) == false) - { + PlayerInventory.isValidHotbarIndex(slotStart) && + PlayerInventory.isValidHotbarIndex(slotEnd)) { + for (int slotNum = slotStart; slotNum <= slotEnd; ++slotNum) { + if (output.contains(slotNum) == false) { output.add(slotNum); } } } - } - else - { + } else { int slotNum = Integer.parseInt(str) - 1; - if (PlayerInventory.isValidHotbarIndex(slotNum) && output.contains(slotNum) == false) - { + if (PlayerInventory.isValidHotbarIndex(slotNum) && output.contains(slotNum) == false) { output.add(slotNum); } } - } - catch (NumberFormatException ignore) - { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.ERROR, "Failed to parse slots from string %s", configStr); + } catch (NumberFormatException ignore) { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.ERROR, "Failed to parse slots from string %s", + configStr); } } } - public static void setUnstackingItems(List names) - { + public static void setUnstackingItems(List names) { UNSTACKING_ITEMS.clear(); - for (String name : names) - { - try - { + for (String name : names) { + try { Item item = Registries.ITEM.get(new Identifier(name)); - if (item != null && item != Items.AIR) - { + if (item != null && item != Items.AIR) { UNSTACKING_ITEMS.add(item); } - } - catch (Exception e) - { + } catch (Exception e) { Tweakeroo.logger.warn("Failed to set an unstacking protected item from name '{}'", name, e); } } } - public static void setRepairModeSlots(List names) - { + public static void setRepairModeSlots(List names) { REPAIR_MODE_SLOTS.clear(); REPAIR_MODE_SLOT_NUMBERS.clear(); - for (String name : names) - { + for (String name : names) { EquipmentSlot type = null; - switch (name) - { - case "mainhand": type = EquipmentSlot.MAINHAND; break; - case "offhand": type = EquipmentSlot.OFFHAND; break; - case "head": type = EquipmentSlot.HEAD; break; - case "chest": type = EquipmentSlot.CHEST; break; - case "legs": type = EquipmentSlot.LEGS; break; - case "feet": type = EquipmentSlot.FEET; break; + switch (name) { + case "mainhand": + type = EquipmentSlot.MAINHAND; + break; + case "offhand": + type = EquipmentSlot.OFFHAND; + break; + case "head": + type = EquipmentSlot.HEAD; + break; + case "chest": + type = EquipmentSlot.CHEST; + break; + case "legs": + type = EquipmentSlot.LEGS; + break; + case "feet": + type = EquipmentSlot.FEET; + break; } - if (type != null) - { + if (type != null) { REPAIR_MODE_SLOTS.add(type); int slotNum = getSlotNumberForEquipmentType(type, null); - if (slotNum >= 0) - { + if (slotNum >= 0) { REPAIR_MODE_SLOT_NUMBERS.add(slotNum); } } } } - public static void setWeaponMapping(List mappings) - { + public static void setWeaponMapping(List mappings) { WEAPON_MAPPING.clear(); - for (String mapping : mappings) - { + for (String mapping : mappings) { String[] split = mapping.replaceAll(" ", "").split("=>"); - if (split.length != 2) - { + if (split.length != 2) { Tweakeroo.logger.warn("Expected weapon mapping to be `entity_ids => weapon_ids` got '{}'", mapping); continue; } @@ -197,46 +180,36 @@ public static void setWeaponMapping(List mappings) HashSet weapons = new HashSet<>(); String entities = split[0].trim(); String items = split[1].trim(); - - if (items.equals("") == false) - { - for (String itemId : items.split(",")) - { - try - { + + if (items.equals("") == false) { + for (String itemId : items.split(",")) { + try { Optional weapon = Registries.ITEM.getOrEmpty(new Identifier(itemId)); - if (weapon.isPresent()) - { + if (weapon.isPresent()) { weapons.add(weapon.get()); continue; } + } catch (Exception ignore) { } - catch (Exception ignore) {} Tweakeroo.logger.warn("Unable to find item to use as weapon: '{}'", itemId); } } - if (entities.equalsIgnoreCase("")) - { + if (entities.equalsIgnoreCase("")) { WEAPON_MAPPING.computeIfAbsent(null, s -> new HashSet<>()).addAll(weapons); - } - else - { - for (String entity_id : entities.split(",")) - { - try - { + } else { + for (String entity_id : entities.split(",")) { + try { Optional> entity = Registries.ENTITY_TYPE.getOrEmpty(new Identifier(entity_id)); - if (entity.isPresent()) - { + if (entity.isPresent()) { WEAPON_MAPPING.computeIfAbsent(entity.get(), s -> new HashSet<>()).addAll(weapons); continue; } + } catch (Exception ignore) { } - catch (Exception ignore) {} Tweakeroo.logger.warn("Unable to find entity: '{}'", entity_id); } @@ -244,11 +217,9 @@ public static void setWeaponMapping(List mappings) } } - private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) - { + private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) { if (REPAIR_MODE_SLOTS.contains(EquipmentSlot.MAINHAND) && - (slotNum - 36) == player.getInventory().selectedSlot) - { + (slotNum - 36) == player.getInventory().selectedSlot) { return true; } @@ -260,21 +231,23 @@ private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) * assuming that the slot number is for the player's main inventory container */ @Nullable - private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity player) - { + private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity player) { if (REPAIR_MODE_SLOTS.contains(EquipmentSlot.MAINHAND) && - (slotNum - 36) == player.getInventory().selectedSlot) - { + (slotNum - 36) == player.getInventory().selectedSlot) { return EquipmentSlot.MAINHAND; } - switch (slotNum) - { - case 45: return EquipmentSlot.OFFHAND; - case 5: return EquipmentSlot.HEAD; - case 6: return EquipmentSlot.CHEST; - case 7: return EquipmentSlot.LEGS; - case 8: return EquipmentSlot.FEET; + switch (slotNum) { + case 45: + return EquipmentSlot.OFFHAND; + case 5: + return EquipmentSlot.HEAD; + case 6: + return EquipmentSlot.CHEST; + case 7: + return EquipmentSlot.LEGS; + case 8: + return EquipmentSlot.FEET; } return null; @@ -284,85 +257,79 @@ private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity p * Returns the slot number for the given equipment type * in the player's inventory container */ - private static int getSlotNumberForEquipmentType(EquipmentSlot type, @Nullable PlayerEntity player) - { - switch (type) - { - case MAINHAND: return player != null ? player.getInventory().selectedSlot + 36 : -1; - case OFFHAND: return 45; - case HEAD: return 5; - case CHEST: return 6; - case LEGS: return 7; - case FEET: return 8; + private static int getSlotNumberForEquipmentType(EquipmentSlot type, @Nullable PlayerEntity player) { + switch (type) { + case MAINHAND: + return player != null ? player.getInventory().selectedSlot + 36 : -1; + case OFFHAND: + return 45; + case HEAD: + return 5; + case CHEST: + return 6; + case LEGS: + return 7; + case FEET: + return 8; } return -1; } - public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) - { + public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) { ScreenHandler container = player.playerScreenHandler; row = MathHelper.clamp(row, 0, 2); int slot = row * 9 + 9; - for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) - { + for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) { fi.dy.masa.malilib.util.InventoryUtils.swapSlots(container, slot, hotbarSlot); slot++; } } - public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemStack stackReference, boolean allowHotbar) - { + public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemStack stackReference, + boolean allowHotbar) { int slotWithItem; - if (stackReference.getItem().isDamageable()) - { + if (stackReference.getItem().isDamageable()) { int minDurability = getMinDurability(stackReference); - slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(player.playerScreenHandler, stackReference, minDurability); - } - else - { + slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(player.playerScreenHandler, + stackReference, minDurability); + } else { slotWithItem = findSlotWithItem(player.playerScreenHandler, stackReference, allowHotbar, true); } - if (slotWithItem != -1) - { + if (slotWithItem != -1) { swapItemToHand(player, hand, slotWithItem); } } - public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowHotbar) - { + public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowHotbar) { ItemStack stackHand = player.getStackInHand(hand); int threshold = Configs.Generic.HAND_RESTOCK_PRE_THRESHOLD.getIntegerValue(); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - Configs.Generic.HAND_RESTOCK_PRE.getBooleanValue() && - stackHand.isEmpty() == false && - stackHand.getCount() <= threshold && stackHand.getMaxCount() > threshold && - PlacementTweaks.canUseItemWithRestriction(PlacementTweaks.HAND_RESTOCK_RESTRICTION, stackHand) && - player.currentScreenHandler == player.playerScreenHandler && - player.currentScreenHandler.getCursorStack().isEmpty()) - { + Configs.Generic.HAND_RESTOCK_PRE.getBooleanValue() && + stackHand.isEmpty() == false && + stackHand.getCount() <= threshold && stackHand.getMaxCount() > threshold && + PlacementTweaks.canUseItemWithRestriction(PlacementTweaks.HAND_RESTOCK_RESTRICTION, stackHand) && + player.currentScreenHandler == player.playerScreenHandler && + player.currentScreenHandler.getCursorStack().isEmpty()) { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.playerScreenHandler; int endSlot = allowHotbar ? 44 : 35; int currentMainHandSlot = player.getInventory().selectedSlot + 36; int currentSlot = hand == Hand.MAIN_HAND ? currentMainHandSlot : 45; - for (int slotNum = 9; slotNum <= endSlot; ++slotNum) - { - if (slotNum == currentMainHandSlot) - { + for (int slotNum = 9; slotNum <= endSlot; ++slotNum) { + if (slotNum == currentMainHandSlot) { continue; } Slot slot = container.slots.get(slotNum); ItemStack stackSlot = slot.getStack(); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(stackSlot, stackHand)) - { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(stackSlot, stackHand)) { // If all the items from the found slot can fit into the current // stack in hand, then left click, otherwise right click to split the stack int button = stackSlot.getCount() + stackHand.getCount() <= stackHand.getMaxCount() ? 0 : 1; @@ -376,188 +343,159 @@ public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowH } } - public static void trySwapCurrentToolIfNearlyBroken() - { + public static void trySwapCurrentToolIfNearlyBroken() { PlayerEntity player = MinecraftClient.getInstance().player; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() && player != null) - { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() && player != null) { trySwapCurrentToolIfNearlyBroken(Hand.MAIN_HAND, player); trySwapCurrentToolIfNearlyBroken(Hand.OFF_HAND, player); } } - public static void trySwapCurrentToolIfNearlyBroken(Hand hand, PlayerEntity player) - { + public static void trySwapCurrentToolIfNearlyBroken(Hand hand, PlayerEntity player) { ItemStack stack = player.getStackInHand(hand); - if (stack.isEmpty() == false) - { + if (stack.isEmpty() == false) { int minDurability = getMinDurability(stack); - if (isItemAtLowDurability(stack, minDurability)) - { + if (isItemAtLowDurability(stack, minDurability)) { swapItemWithHigherDurabilityToHand(player, hand, stack, minDurability + 1); } } } - public static void trySwitchToWeapon(Entity entity) - { + public static void trySwitchToWeapon(Entity entity) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; if (player != null && mc.world != null && - TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) - { + TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) { ScreenHandler container = player.playerScreenHandler; ItemPickerTest test; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) - { - test = (currentStack, previous) -> InventoryUtils.isBetterWeaponAndHasDurability(currentStack, previous, entity); - } - else - { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) { + test = (currentStack, previous) -> InventoryUtils.isBetterWeaponAndHasDurability(currentStack, previous, + entity); + } else { test = (currentStack, previous) -> InventoryUtils.isBetterWeapon(currentStack, previous, entity); } - int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), UniformIntProvider.create(9, 35)); + int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), + UniformIntProvider.create(9, 35)); - if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) - { + if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) { swapToolToHand(slotNumber, mc); PlacementTweaks.cacheStackInHand(Hand.MAIN_HAND); } } } - private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) - { - return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) && (makesMoreDamage(testedStack, previousWeapon) || matchesWeaponMapping(previousWeapon, entity) == false); + private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) { + return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) + && (makesMoreDamage(testedStack, previousWeapon) + || matchesWeaponMapping(previousWeapon, entity) == false); } - private static boolean isBetterWeaponAndHasDurability(ItemStack testedStack, ItemStack previousTool, Entity entity) - { + private static boolean isBetterWeaponAndHasDurability(ItemStack testedStack, ItemStack previousTool, + Entity entity) { return hasEnoughDurability(testedStack) && isBetterWeapon(testedStack, previousTool, entity); } - private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previousTool) - { + private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previousTool) { return getBaseAttackDamage(testedStack) > getBaseAttackDamage(previousTool); } - private static float getBaseAttackDamage(ItemStack stack) - { + private static float getBaseAttackDamage(ItemStack stack) { Item item = stack.getItem(); - if (item instanceof SwordItem) - { + if (item instanceof SwordItem) { return ((SwordItem) item).getAttackDamage(); - } - else if (item instanceof MiningToolItem) - { + } else if (item instanceof MiningToolItem) { return ((MiningToolItem) item).getAttackDamage(); } return 0F; } - protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) - { + protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) { HashSet weapons = WEAPON_MAPPING.getOrDefault(entity.getType(), WEAPON_MAPPING.get(null)); return weapons != null && weapons.contains(stack.getItem()); } - public static void trySwitchToEffectiveTool(BlockPos pos) - { + public static void trySwitchToEffectiveTool(BlockPos pos) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; if (player != null && mc.world != null && - TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) - { + TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) { BlockState state = mc.world.getBlockState(pos); ScreenHandler container = player.playerScreenHandler; ItemPickerTest test; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) - { - test = (currentStack, previous) -> InventoryUtils.isBetterToolAndHasDurability(currentStack, previous, state); - } - else - { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) { + test = (currentStack, previous) -> InventoryUtils.isBetterToolAndHasDurability(currentStack, previous, + state); + } else { test = (currentStack, previous) -> InventoryUtils.isBetterTool(currentStack, previous, state); } - int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), UniformIntProvider.create(9, 35)); + int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), + UniformIntProvider.create(9, 35)); - if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) - { + if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) { swapToolToHand(slotNumber, mc); } } } - private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) - { + private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { return testedStack.isEmpty() == false && isMoreEffectiveTool(testedStack, previousTool, state); } - private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemStack previousTool, BlockState state) - { + private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemStack previousTool, + BlockState state) { return hasEnoughDurability(testedStack) && isBetterTool(testedStack, previousTool, state); } - private static boolean isMoreEffectiveTool(ItemStack testedStack, ItemStack previousTool, BlockState state) - { + private static boolean isMoreEffectiveTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { return getBaseBlockBreakingSpeed(testedStack, state) > getBaseBlockBreakingSpeed(previousTool, state); } - protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState state) - { + protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState state) { float speed = stack.getMiningSpeedMultiplier(state); - if (speed > 1.0f) - { + if (speed > 1.0f) { int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); - if (effLevel > 0) - { + if (effLevel > 0) { speed += (effLevel * effLevel) + 1; } } - if (state.isToolRequired() && stack.isSuitableFor(state) == false) - { + if (state.isToolRequired() && stack.isSuitableFor(state) == false) { speed /= (100F / 30F); } return speed; } - protected static boolean hasEnoughDurability(ItemStack stack) - { + protected static boolean hasEnoughDurability(ItemStack stack) { return stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack); } - private static int findSuitableSlot(ScreenHandler container, Predicate itemTest) - { + private static int findSuitableSlot(ScreenHandler container, Predicate itemTest) { return findSuitableSlot(container, itemTest, UniformIntProvider.create(9, container.slots.size() - 1)); } - private static int findSuitableSlot(ScreenHandler container, Predicate itemTest, UniformIntProvider... ranges) - { + private static int findSuitableSlot(ScreenHandler container, Predicate itemTest, + UniformIntProvider... ranges) { final int max = container.slots.size() - 1; - for (UniformIntProvider range : ranges) - { + for (UniformIntProvider range : ranges) { int end = Math.min(max, range.getMax()); - for (int slotNumber = range.getMin(); slotNumber <= end; ++slotNumber) - { - if (itemTest.test(container.getSlot(slotNumber).getStack())) - { + for (int slotNumber = range.getMin(); slotNumber <= end; ++slotNumber) { + if (itemTest.test(container.getSlot(slotNumber).getStack())) { return slotNumber; } } @@ -566,22 +504,19 @@ private static int findSuitableSlot(ScreenHandler container, Predicate slotNumbers) - { + private static int findEmptySlot(ScreenHandler container, Collection slotNumbers) { final int maxSlot = container.slots.size() - 1; - for (int slotNumber : slotNumbers) - { + for (int slotNumber : slotNumbers) { if (slotNumber >= 0 && slotNumber <= maxSlot && - container.getSlot(slotNumber).hasStack() == false) - { + container.getSlot(slotNumber).hasStack() == false) { return slotNumber; } } @@ -607,20 +539,16 @@ private static int findEmptySlot(ScreenHandler container, Collection sl return -1; } - public interface ItemPickerTest - { + public interface ItemPickerTest { boolean isBetterMatch(ItemStack testedStack, ItemStack previousBestMatch); } - private static boolean isItemAtLowDurability(ItemStack stack, int minDurability) - { + private static boolean isItemAtLowDurability(ItemStack stack, int minDurability) { return stack.isDamageable() && (stack.getMaxDamage() - stack.getDamage()) <= minDurability; } - private static int getMinDurability(ItemStack stack) - { - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() == false) - { + private static int getMinDurability(ItemStack stack) { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() == false) { return 0; } @@ -629,21 +557,20 @@ private static int getMinDurability(ItemStack stack) // For items with low maximum durability, use 8% as the threshold, // if the configured durability threshold is over that. if (stack.getMaxDamage() <= 100 && minDurability <= 20 && - (double) minDurability / (double) stack.getMaxDamage() > 0.08) - { + (double) minDurability / (double) stack.getMaxDamage() > 0.08) { minDurability = (int) Math.ceil(stack.getMaxDamage() * 0.08); } return minDurability; } - private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand hand, ItemStack stackReference, int minDurabilityLeft) - { + private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand hand, ItemStack stackReference, + int minDurabilityLeft) { ScreenHandler container = player.playerScreenHandler; - int slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(container, stackReference, minDurabilityLeft); + int slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(container, stackReference, + minDurabilityLeft); - if (slotWithItem != -1) - { + if (slotWithItem != -1) { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_for_better_durability"); return; @@ -651,8 +578,7 @@ private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand slotWithItem = fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(container, false, false); - if (slotWithItem != -1) - { + if (slotWithItem != -1) { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_off_players_hand"); return; @@ -660,66 +586,55 @@ private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand slotWithItem = findSuitableSlot(container, (s) -> s.isDamageable() == false); - if (slotWithItem != -1) - { + if (slotWithItem != -1) { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_for_dummy_item"); } } - public static void repairModeSwapItems(PlayerEntity player) - { - if (player.currentScreenHandler == player.playerScreenHandler) - { - for (EquipmentSlot type : REPAIR_MODE_SLOTS) - { + public static void repairModeSwapItems(PlayerEntity player) { + if (player.currentScreenHandler == player.playerScreenHandler) { + for (EquipmentSlot type : REPAIR_MODE_SLOTS) { repairModeHandleSlot(player, type); } } } - private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type) - { + private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type) { int slotNum = getSlotNumberForEquipmentType(type, player); - if (slotNum == -1) - { + if (slotNum == -1) { return; } ItemStack stack = player.getEquippedStack(type); if (stack.isEmpty() == false && - (stack.isDamageable() == false || - stack.isDamaged() == false || - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) <= 0)) - { + (stack.isDamageable() == false || + stack.isDamaged() == false || + EnchantmentHelper.getLevel(Enchantments.MENDING, stack) <= 0)) { Slot slot = player.currentScreenHandler.getSlot(slotNum); int slotRepairableItem = findRepairableItemNotInRepairableSlot(slot, player); - if (slotRepairableItem != -1) - { + if (slotRepairableItem != -1) { swapItemToEquipmentSlot(player, type, slotRepairableItem); - InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", type.getName()); + InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", + type.getName()); } } } - private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player) - { + private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player) { ScreenHandler containerPlayer = player.currentScreenHandler; - for (Slot slot : containerPlayer.slots) - { - if (slot.hasStack() && isConfiguredRepairSlot(slot.id, player) == false) - { + for (Slot slot : containerPlayer.slots) { + if (slot.hasStack() && isConfiguredRepairSlot(slot.id, player) == false) { ItemStack stack = slot.getStack(); // Don't take items from the current hotbar slot if ((slot.id - 36) != player.getInventory().selectedSlot && - stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) > 0) - { + stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && + EnchantmentHelper.getLevel(Enchantments.MENDING, stack) > 0) { return slot.id; } } @@ -728,51 +643,55 @@ private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, Player return -1; } - public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) - { - if (player == null || GuiUtils.getCurrentScreen() != null) - { + public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) { + if (player == null || GuiUtils.getCurrentScreen() != null) { return; } ScreenHandler container = player.currentScreenHandler; ItemStack currentStack = player.getEquippedStack(EquipmentSlot.CHEST); - Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem && ((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; + Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem + && ((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; Predicate stackFilterElytra = (s) -> s.getItem() instanceof ElytraItem && ElytraItem.isUsable(s); - Predicate stackFilter = (currentStack.isEmpty() || stackFilterChestPlate.test(currentStack)) ? stackFilterElytra : stackFilterChestPlate; - Predicate finalFilter = (s) -> s.isEmpty() == false && stackFilter.test(s) && s.getDamage() < s.getMaxDamage() - 10; + Predicate stackFilter = (currentStack.isEmpty() || stackFilterChestPlate.test(currentStack)) + ? stackFilterElytra + : stackFilterChestPlate; + Predicate finalFilter = (s) -> s.isEmpty() == false && stackFilter.test(s) + && s.getDamage() < s.getMaxDamage() - 10; int targetSlot = findSuitableSlot(container, finalFilter); - if (targetSlot >= 0) - { - //targetSlots.sort(); + if (targetSlot >= 0) { + // targetSlots.sort(); swapItemToEquipmentSlot(player, EquipmentSlot.CHEST, targetSlot); } } /** * - * Finds a slot with an identical item than stackReference, ignoring the durability - * of damageable items. Does not allow crafting or armor slots or the offhand slot + * Finds a slot with an identical item than stackReference, ignoring the + * durability + * of damageable items. Does not allow crafting or armor slots or the offhand + * slot * in the ContainerPlayer container. + * * @return the slot number, or -1 if none were found */ - public static int findSlotWithItem(ScreenHandler container, ItemStack stackReference, boolean allowHotbar, boolean reverse) - { + public static int findSlotWithItem(ScreenHandler container, ItemStack stackReference, boolean allowHotbar, + boolean reverse) { final int startSlot = reverse ? container.slots.size() - 1 : 0; final int endSlot = reverse ? -1 : container.slots.size(); final int increment = reverse ? -1 : 1; final boolean isPlayerInv = container instanceof PlayerScreenHandler; - for (int slotNum = startSlot; slotNum != endSlot; slotNum += increment) - { + for (int slotNum = startSlot; slotNum != endSlot; slotNum += increment) { Slot slot = container.slots.get(slotNum); - if ((isPlayerInv == false || fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false)) && - (allowHotbar || isHotbarSlot(slot) == false) && - fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(slot.getStack(), stackReference)) - { + if ((isPlayerInv == false || fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false)) + && + (allowHotbar || isHotbarSlot(slot) == false) && + fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(slot.getStack(), + stackReference)) { return slot.id; } } @@ -780,129 +699,105 @@ public static int findSlotWithItem(ScreenHandler container, ItemStack stackRefer return -1; } - private static boolean isHotbarSlot(Slot slot) - { + private static boolean isHotbarSlot(Slot slot) { return isHotbarSlot(slot.id); } - private static boolean isHotbarSlot(int slot) - { + private static boolean isHotbarSlot(int slot) { return slot >= 36 && slot < (36 + PlayerInventory.getHotbarSize()); } - private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumber) - { + private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumber) { ScreenHandler container = player.currentScreenHandler; - if (slotNumber != -1 && container == player.playerScreenHandler) - { + if (slotNumber != -1 && container == player.playerScreenHandler) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inventory = player.getInventory(); - if (hand == Hand.MAIN_HAND) - { + if (hand == Hand.MAIN_HAND) { int currentHotbarSlot = inventory.selectedSlot; - if (isHotbarSlot(slotNumber)) - { + if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); + } else { + mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, + SlotActionType.SWAP, mc.player); } - else - { - mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player); - } - } - else if (hand == Hand.OFF_HAND) - { + } else if (hand == Hand.OFF_HAND) { mc.interactionManager.clickSlot(container.syncId, slotNumber, 40, SlotActionType.SWAP, mc.player); } } } - - private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot type, int sourceSlotNumber) - { - if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) - { + private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot type, int sourceSlotNumber) { + if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.playerScreenHandler; int equipmentSlotNumber = getSlotNumberForEquipmentType(type, player); int equipmentSlotInvIndex = container.getSlot(equipmentSlotNumber).getIndex(); - mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, SlotActionType.SWAP, mc.player); + mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, + SlotActionType.SWAP, mc.player); } } - private static void swapToolToHand(int slotNumber, MinecraftClient mc) - { + private static void swapToolToHand(int slotNumber, MinecraftClient mc) { PlayerEntity player = mc.player; - if (slotNumber >= 0 && player.currentScreenHandler == player.playerScreenHandler) - { + if (slotNumber >= 0 && player.currentScreenHandler == player.playerScreenHandler) { PlayerInventory inventory = player.getInventory(); ScreenHandler container = player.playerScreenHandler; - if (isHotbarSlot(slotNumber)) - { + if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); - } - else - { + } else { int selectedSlot = inventory.selectedSlot; int hotbarSlot = getUsableHotbarSlotForTool(selectedSlot, TOOL_SWITCHABLE_SLOTS, container); - if (PlayerInventory.isValidHotbarIndex(hotbarSlot)) - { - if (hotbarSlot != selectedSlot) - { + if (PlayerInventory.isValidHotbarIndex(hotbarSlot)) { + if (hotbarSlot != selectedSlot) { inventory.selectedSlot = hotbarSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } - mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); + mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, + mc.player); } } } } - private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection validSlots, ScreenHandler container) - { + private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection validSlots, + ScreenHandler container) { int first = -1; int nonTool = -1; - if (validSlots.contains(currentHotbarSlot)) - { + if (validSlots.contains(currentHotbarSlot)) { ItemStack stack = container.getSlot(currentHotbarSlot + 36).getStack(); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { return currentHotbarSlot; } - if ((stack.getItem() instanceof ToolItem) == false) - { + if ((stack.getItem() instanceof ToolItem) == false) { nonTool = currentHotbarSlot; } } - for (int hotbarSlot : validSlots) - { + for (int hotbarSlot : validSlots) { ItemStack stack = container.getSlot(hotbarSlot + 36).getStack(); - if (stack.isEmpty()) - { + if (stack.isEmpty()) { return hotbarSlot; } - if (nonTool == -1 && (stack.getItem() instanceof ToolItem) == false) - { + if (nonTool == -1 && (stack.getItem() instanceof ToolItem) == false) { nonTool = hotbarSlot; } - if (first == -1) - { + if (first == -1) { first = hotbarSlot; } } @@ -910,18 +805,16 @@ private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection< return nonTool >= 0 ? nonTool : first; } - private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenHandler container, ItemStack stackReference, int minDurabilityLeft) - { - for (Slot slot : container.slots) - { + private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenHandler container, + ItemStack stackReference, int minDurabilityLeft) { + for (Slot slot : container.slots) { ItemStack stackSlot = slot.getStack(); // Only accept regular inventory slots (no crafting, armor slots, or offhand) if (fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false) && - ItemStack.areItemsEqual(stackSlot, stackReference) && - stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && - hasSameIshEnchantments(stackReference, stackSlot)) - { + ItemStack.areItemsEqual(stackSlot, stackReference) && + stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && + hasSameIshEnchantments(stackReference, stackSlot)) { return slot.id; } } @@ -929,56 +822,46 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH return -1; } - private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) - { + private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) { int level = EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stackReference); - if (level > 0) - { + if (level > 0) { return EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) >= level; } level = EnchantmentHelper.getLevel(Enchantments.FORTUNE, stackReference); - if (level > 0) - { + if (level > 0) { return EnchantmentHelper.getLevel(Enchantments.FORTUNE, stack) >= level; } return true; } - private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) - { + private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) { int slotNum = -1; float bestSpeed = -1f; - for (Slot slot : container.slots) - { + for (Slot slot : container.slots) { // Don't consider armor and crafting slots - if (slot.id <= 8 || slot.hasStack() == false) - { + if (slot.id <= 8 || slot.hasStack() == false) { continue; } ItemStack stack = slot.getStack(); - if (stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack)) - { + if (stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack)) { float speed = stack.getMiningSpeedMultiplier(state); - if (speed > 1.0f) - { + if (speed > 1.0f) { int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); - if (effLevel > 0) - { + if (effLevel > 0) { speed += (effLevel * effLevel) + 1; } } - if (speed > 1f && (slotNum == -1 || speed > bestSpeed)) - { + if (speed > 1f && (slotNum == -1 || speed > bestSpeed)) { slotNum = slot.id; bestSpeed = speed; } @@ -988,131 +871,114 @@ private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler con return slotNum; } - private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack stackReference) - { + private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack stackReference) { List slots = new ArrayList<>(); ScreenHandler container = player.playerScreenHandler; MinecraftClient mc = MinecraftClient.getInstance(); - for (Slot slot : container.slots) - { + for (Slot slot : container.slots) { // Inventory crafting and armor slots are not valid - if (slot.id < 8) - { + if (slot.id < 8) { continue; } ItemStack stack = slot.getStack(); - if (stack.getCount() < stack.getMaxCount() && fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackReference, stack)) - { + if (stack.getCount() < stack.getMaxCount() + && fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackReference, stack)) { slots.add(slot); } } - for (int i = 0; i < slots.size(); ++i) - { + for (int i = 0; i < slots.size(); ++i) { Slot slot1 = slots.get(i); - for (int j = i + 1; j < slots.size(); ++j) - { + for (int j = i + 1; j < slots.size(); ++j) { Slot slot2 = slots.get(j); ItemStack stack = slot1.getStack(); - if (stack.getCount() < stack.getMaxCount()) - { + if (stack.getCount() < stack.getMaxCount()) { // Pick up the item from slot1 and try to put it in slot2 mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest - if (player.getInventory().getMainHandStack().isEmpty() == false) - { + if (player.getInventory().getMainHandStack().isEmpty() == false) { mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } - if (slot2.getStack().getCount() >= slot2.getStack().getMaxCount()) - { + if (slot2.getStack().getCount() >= slot2.getStack().getMaxCount()) { slots.remove(j); --j; } } - if (slot1.hasStack() == false) - { + if (slot1.hasStack() == false) { break; } } } } - public static boolean canUnstackingItemNotFitInInventory(ItemStack stack, PlayerEntity player) - { + public static boolean canUnstackingItemNotFitInInventory(ItemStack stack, PlayerEntity player) { if (FeatureToggle.TWEAK_ITEM_UNSTACKING_PROTECTION.getBooleanValue() && - stack.getCount() > 1 && - UNSTACKING_ITEMS.contains(stack.getItem())) - { - if (fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, false) == -1) - { + stack.getCount() > 1 && + UNSTACKING_ITEMS.contains(stack.getItem())) { + if (fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, + false) == -1) { tryCombineStacksInInventory(player, stack); - return fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, false) == -1; + return fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, + false, false) == -1; } } return false; } - public static void switchToPickedBlock() - { - MinecraftClient mc = MinecraftClient.getInstance(); + public static void switchToPickedBlock() { + MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; World world = mc.world; - if (player == null || world == null || player.currentScreenHandler != player.playerScreenHandler) - { + if (player == null || world == null || player.currentScreenHandler != player.playerScreenHandler) { return; } - double reach = mc.interactionManager.getReachDistance(); + double reach = mc.player.getBlockInteractionRange(); boolean isCreative = player.isCreative(); HitResult trace = player.raycast(reach, mc.getTickDelta(), false); - if (trace != null && trace.getType() == HitResult.Type.BLOCK) - { + if (trace != null && trace.getType() == HitResult.Type.BLOCK) { BlockPos pos = ((BlockHitResult) trace).getBlockPos(); BlockState stateTargeted = world.getBlockState(pos); ItemStack stack = stateTargeted.getBlock().getPickStack(world, pos, stateTargeted); if (stack.isEmpty() == false && - fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) - { + fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) { ScreenHandler container = player.currentScreenHandler; PlayerInventory inventory = player.getInventory(); /* - if (isCreative) - { - TileEntity te = world.getTileEntity(pos); - - if (te != null) - { - mc.storeTEInStack(stack, te); - } - } - */ - - if (isCreative) - { + * if (isCreative) + * { + * TileEntity te = world.getTileEntity(pos); + * + * if (te != null) + * { + * mc.storeTEInStack(stack, te); + * } + * } + */ + + if (isCreative) { inventory.addPickBlock(stack); - mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); - } - else - { - //player.getInventory().getSlotFor(stack); + mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), + 36 + inventory.selectedSlot); + } else { + // player.getInventory().getSlotFor(stack); int slotNumber = fi.dy.masa.malilib.util.InventoryUtils.findSlotWithItem(container, stack, true); - if (slotNumber != -1) - { + if (slotNumber != -1) { swapItemToHand(player, Hand.MAIN_HAND, slotNumber); } } @@ -1120,32 +986,26 @@ public static void switchToPickedBlock() } } - public static boolean cleanUpShulkerBoxNBT(ItemStack stack) - { + public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { boolean changed = false; NbtCompound nbt = stack.getNbt(); - if (nbt != null) - { - if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) - { + if (nbt != null) { + if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) { NbtCompound tag = nbt.getCompound("BlockEntityTag"); if (tag.contains("Items", Constants.NBT.TAG_LIST) && - tag.getList("Items", Constants.NBT.TAG_COMPOUND).size() == 0) - { + tag.getList("Items", Constants.NBT.TAG_COMPOUND).size() == 0) { tag.remove("Items"); changed = true; } - if (tag.isEmpty()) - { + if (tag.isEmpty()) { nbt.remove("BlockEntityTag"); } } - if (nbt.isEmpty()) - { + if (nbt.isEmpty()) { stack.setNbt(null); changed = true; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d4a88469d..d1f609b8b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.20.3", - "malilib": ">=0.18.0" + "minecraft": ">=1.20.4", + "malilib": ">=0.19.0" } } From fc069719db25d6d3bacf4d7135f5ba7076053c3d Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:55:49 -0500 Subject: [PATCH 002/128] fix Block/Entity Reach overrides --- .../fi/dy/masa/tweakeroo/config/Configs.java | 1434 +++++++++-------- .../tweakeroo/mixin/MixinPlayerEntity.java | 8 +- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 769 insertions(+), 675 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 9f01acd65..8c8e191c0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -33,689 +33,783 @@ import net.minecraft.client.MinecraftClient; public class Configs implements IConfigHandler { - private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; - - public static class Generic { - public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger("afterClickerClickCount", 1, 1, - 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, 64, - "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, 64, - "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( - "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); - public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, - "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList("breakingRestrictionMode", - PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); - public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", "#80000000", - "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); - public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", - "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); - public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( - "carpetAccuratePlacementProtocol", true, - "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); - public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean("clientPlacementRotation", true, - "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); - public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger("customInventoryGuiScale", 2, - 1, 10, - "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); - public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList("elytraCameraIndicator", - ActiveMode.WITH_KEY, - "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( - "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); - public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger("fastBlockPlacementCount", 2, - 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); - public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean("fastLeftClickAllowTools", - false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); - public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, 64, - "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); - public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( - "fastPlacementRememberOrientation", true, - "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); - public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, 1, 64, - "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); - public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, - 1000000000, - "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); - public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( - "flexibleBlockPlacementOverlayColor", "#C03030F0", - "The color of the currently pointed-at\nregion in block placement the overlay"); - public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", 0.4, 0.0, - 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); - public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, - "The fly speed for preset 1"); - public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, - "The fly speed for preset 2"); - public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, - "The fly speed for preset 3"); - public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, - "The fly speed for preset 4"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean("freeCameraPlayerInputs", false, - "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); - public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean("freeCameraPlayerMovement", - false, - "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); - public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, 32, - "The gamma value to use when the override option is enabled"); - public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, - "If enabled, then hand restocking happens\nbefore the stack runs out"); - public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger("handRestockPreThreshold", 6, - 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); - public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( - "hangableEntityBypassInverse", false, - "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); - public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, 9, - "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); - public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger("hotbarSlotRandomizerMax", 5, - 1, 9, - "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); - public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( - "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger("hotbarSwapOverlayOffsetX", - 4, "The horizontal offset of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger("hotbarSwapOverlayOffsetY", - 4, "The vertical offset of the hotbar swap overlay"); - public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( - "itemSwapDurabilityThreshold", 20, 5, 10000, - "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); - public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean("itemUsePacketCheckBypass", - true, - "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); - public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, - "The size of the rendered map previews"); - public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", 20, 0, - Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); - public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, 0, - Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( - "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( - "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, - "The number of game ticks between starting to hold down attack (left click)"); - public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger("periodicHoldUseDuration", 20, - 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); - public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger("periodicHoldUseInterval", 20, - 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); - public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean("permanentSneakAllowInGUIs", - false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); - public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, 1000, - "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, - "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( - "placementRestrictionMode", PlacementRestrictionMode.FACE, - "The Placement Restriction mode to use (hotkey-selectable)"); - public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( - "placementRestrictionTiedToFast", true, - "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); - public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( - "potionWarningBeneficialOnly", true, - "Only warn about potion effects running out that are marked as \"beneficial\""); - public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", 600, 1, - 1000000, - "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); - public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", true, - "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); - public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, 10000, - "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, 10000, - "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger("sculkSensorPulseLength", 40, 0, - 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); - public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean("shulkerDisplayBgColor", - true, - "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); - public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( - "shulkerDisplayRequireShift", true, - "Whether or not holding shift is required for the Shulker Box preview"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, - "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean("slotSyncWorkaroundAlways", - false, - "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); - public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, - "Whether or not to render the snap aim angle indicator"); - public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", "#603030FF", - "The color for the snap aim indicator background"); - public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", SnapAimMode.YAW, - "Snap aim mode: yaw, or pitch, or both"); - public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean("snapAimOnlyCloseToAngle", - true, - "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); - public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", false, - "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); - public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, - "The pitch angle step of the snap aim tweak"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", 1.5, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, - "The yaw angle step of the snap aim tweak"); - public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", 128, 1, - 256, "The maximum dimensions for a Structure Block's saved area"); - public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", - "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); - public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", "", - "The slots where the Tool Switch tweak does not work when they are active."); - public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( - "zoomAdjustMouseSensitivity", true, - "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); - public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, - "The FOV value used for the zoom feature"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - CARPET_ACCURATE_PLACEMENT_PROTOCOL, - CLIENT_PLACEMENT_ROTATION, - FAST_LEFT_CLICK_ALLOW_TOOLS, - FAST_PLACEMENT_REMEMBER_ALWAYS, - FREE_CAMERA_PLAYER_INPUTS, - FREE_CAMERA_PLAYER_MOVEMENT, - HAND_RESTOCK_PRE, - HANGABLE_ENTITY_BYPASS_INVERSE, - ITEM_USE_PACKET_CHECK_BYPASS, - PERMANENT_SNEAK_ALLOW_IN_GUIS, - PLACEMENT_RESTRICTION_TIED_TO_FAST, - POTION_WARNING_BENEFICIAL_ONLY, - REMEMBER_FLEXIBLE, - SHULKER_DISPLAY_BACKGROUND_COLOR, - SHULKER_DISPLAY_REQUIRE_SHIFT, - SLOT_SYNC_WORKAROUND, - SLOT_SYNC_WORKAROUND_ALWAYS, - SNAP_AIM_INDICATOR, - SNAP_AIM_ONLY_CLOSE_TO_ANGLE, - SNAP_AIM_PITCH_OVERSHOOT, - ZOOM_ADJUST_MOUSE_SENSITIVITY, - - BLOCK_TYPE_BREAK_RESTRICTION_WARN, - BREAKING_RESTRICTION_MODE, - ELYTRA_CAMERA_INDICATOR, - ENTITY_TYPE_ATTACK_RESTRICTION_WARN, - PLACEMENT_RESTRICTION_MODE, - HOTBAR_SWAP_OVERLAY_ALIGNMENT, - SNAP_AIM_MODE, - - CHAT_TIME_FORMAT, - CHAT_BACKGROUND_COLOR, - FLEXIBLE_PLACEMENT_OVERLAY_COLOR, - SNAP_AIM_INDICATOR_COLOR, - - AFTER_CLICKER_CLICK_COUNT, - BLOCK_REACH_DISTANCE, - BREAKING_GRID_SIZE, - CUSTOM_INVENTORY_GUI_SCALE, - FAST_BLOCK_PLACEMENT_COUNT, - FAST_LEFT_CLICK_COUNT, - FAST_RIGHT_CLICK_COUNT, - FILL_CLONE_LIMIT, - FLY_DECELERATION_FACTOR, - FLY_SPEED_PRESET_1, - FLY_SPEED_PRESET_2, - FLY_SPEED_PRESET_3, - FLY_SPEED_PRESET_4, - GAMMA_OVERRIDE_VALUE, - HAND_RESTOCK_PRE_THRESHOLD, - HOTBAR_SLOT_CYCLE_MAX, - HOTBAR_SLOT_RANDOMIZER_MAX, - HOTBAR_SWAP_OVERLAY_OFFSET_X, - HOTBAR_SWAP_OVERLAY_OFFSET_Y, - ITEM_SWAP_DURABILITY_THRESHOLD, - MAP_PREVIEW_SIZE, - PERIODIC_ATTACK_INTERVAL, - PERIODIC_USE_INTERVAL, - PERIODIC_HOLD_ATTACK_DURATION, - PERIODIC_HOLD_ATTACK_INTERVAL, - PERIODIC_HOLD_USE_DURATION, - PERIODIC_HOLD_USE_INTERVAL, - PLACEMENT_GRID_SIZE, - PLACEMENT_LIMIT, - POTION_WARNING_THRESHOLD, - RENDER_LIMIT_ITEM, - RENDER_LIMIT_XP_ORB, - SCULK_SENSOR_PULSE_LENGTH, - SNAP_AIM_PITCH_STEP, - SNAP_AIM_THRESHOLD_PITCH, - SNAP_AIM_THRESHOLD_YAW, - SNAP_AIM_YAW_STEP, - STRUCTURE_BLOCK_MAX_SIZE, - TOOL_SWITCHABLE_SLOTS, - TOOL_SWITCH_IGNORED_SLOTS, - ZOOM_FOV); - } - - public static class Fixes { - public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, - "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); - public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, - "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); - public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( - "ravagerClientBlockBreakFix", false, - "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - ELYTRA_FIX, - MAC_HORIZONTAL_SCROLL, - RAVAGER_CLIENT_BLOCK_BREAK_FIX); - } - - public static class Lists { - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "blockTypeBreakRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Block Type Break Restriction tweak"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( - "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), - "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( - "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), - "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); - public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", - ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", - "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", - "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), - "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "entityTypeAttackRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Entity Type Attack Restriction tweak"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( - "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), - "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( - "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), - "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", - ImmutableList.of( - " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", - "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", - "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), - "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); - public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( - "fastPlacementItemListType", ListType.BLACKLIST, - "The item restriction type for the Fast Block Placement tweak"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( - "fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), - "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( - "fastPlacementItemWhiteList", ImmutableList.of(), - "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( - "fastRightClickBlockListType", ListType.BLACKLIST, - "The targeted block restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( - "fastRightClickBlockBlackList", - ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", - "minecraft:white_shulker_box"), - "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( - "fastRightClickBlockWhiteList", ImmutableList.of(), - "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( - "fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( - "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), - "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( - "fastRightClickWhiteList", - ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", - "minecraft:glass_bottle"), - "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); - public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", - ImmutableList.of( - "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", - "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), - "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); - public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", - ListType.NONE, "The restriction list type for the Hand Restock tweak"); - public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", - ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), - "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); - public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", - ImmutableList.of(), - "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); - public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", - ListType.NONE, "The list type for potion warning effects"); - public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", - ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", - "minecraft:slowness", "minecraft:weakness"), - "The potion effects that will not be warned about"); - public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", - ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), - "The only potion effects that will be warned about"); - public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", - ImmutableList.of("mainhand", "offhand"), - "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); - public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", - ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), - "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, - BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST, - BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST, - CREATIVE_EXTRA_ITEMS, - ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE, - ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST, - ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST, - ENTITY_WEAPON_MAPPING, - FAST_PLACEMENT_ITEM_LIST_TYPE, - FAST_RIGHT_CLICK_BLOCK_LIST_TYPE, - FAST_RIGHT_CLICK_ITEM_LIST_TYPE, - POTION_WARNING_LIST_TYPE, - FAST_PLACEMENT_ITEM_BLACKLIST, - FAST_PLACEMENT_ITEM_WHITELIST, - FAST_RIGHT_CLICK_BLOCK_BLACKLIST, - FAST_RIGHT_CLICK_BLOCK_WHITELIST, - FAST_RIGHT_CLICK_ITEM_BLACKLIST, - FAST_RIGHT_CLICK_ITEM_WHITELIST, - FLAT_WORLD_PRESETS, - HAND_RESTOCK_LIST_TYPE, - HAND_RESTOCK_BLACKLIST, - HAND_RESTOCK_WHITELIST, - POTION_WARNING_BLACKLIST, - POTION_WARNING_WHITELIST, - REPAIR_MODE_SLOTS, - UNSTACKING_ITEMS); - } - - public static class Disable { - public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( - "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); - public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( - "disableAxeStripping", false, "", "Disables stripping logs with an axe"); - public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient("disableBatSpawning", - false, "", "Disables Bat spawning in single player"); - public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( - "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( - "disableBlockBreakingParticles", false, "", - "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( - "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, - "", "Disables boss bar rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, - "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( - "disableChunkRendering", false, "", - "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( - "disableClientEntityUpdates", false, "", - "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( - "disableClientLightUpdates", false, "", "Disables all client-side light updates"); - public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( - "disableConstantChunkSaving", false, "", - "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); - public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( - "disableCreativeMenuInfestedBlocks", false, "", - "Removes infested stone blocks from the creative search inventory"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( - "disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( - "disableDeadMobTargeting", false, "", - "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableEntityRendering", false, "", - "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( - "disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( - "disableFallingBlockEntityRendering", false, "", - "If enabled, then falling block entities won't be rendered at all"); - public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( - "disableFirstPersonEffectParticles", false, "", - "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); - public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( - "disableInventoryEffectRendering", false, "", - "Removes the potion effect rendering from the inventory GUIs"); - public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( - "disableItemSwitchRenderCooldown", false, "", - "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); - public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( - "disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); - public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( - "disableNauseaEffect", false, "", "Disables the nausea visual effects"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", - false, "", "Removes the fog in the Nether"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( - "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); - public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", false, - "", "Disable Observers from triggering at all"); - public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( - "disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); - public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", - false, "", "Disables all particles"); - public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( - "disablePortalGuiClosing", false, "", - "If enabled, then you can still open GUIs while in a Nether Portal"); - public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", - false, "", "Disables rain rendering and sounds"); - public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( - "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); - public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( - "disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); - public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( - "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); - public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( - "disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); - public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( - "disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); - public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, - "", "Prevent the Sign edit GUI from opening"); - public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", - false, "", - "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); - public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( - "disableSlimeBlockSlowdown", false, "", - "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( - "disableStatusEffectHud", false, "", - "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( - "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( - "disableVillagerTradeLocking", false, "", - "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); - public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( - "disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( - "disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - DISABLE_ARMOR_STAND_RENDERING, - DISABLE_AXE_STRIPPING, - DISABLE_BAT_SPAWNING, - DISABLE_BEACON_BEAM_RENDERING, - DISABLE_BLOCK_BREAK_PARTICLES, - DISABLE_DOUBLE_TAP_SPRINT, - DISABLE_BOSS_BAR, - DISABLE_BOSS_FOG, - DISABLE_CHUNK_RENDERING, - DISABLE_CLIENT_ENTITY_UPDATES, - DISABLE_CLIENT_LIGHT_UPDATES, - DISABLE_CONSTANT_CHUNK_SAVING, - DISABLE_CREATIVE_INFESTED_BLOCKS, - DISABLE_DEAD_MOB_RENDERING, - DISABLE_DEAD_MOB_TARGETING, - DISABLE_ENTITY_RENDERING, - DISABLE_ENTITY_TICKING, - DISABLE_FALLING_BLOCK_RENDER, - DISABLE_FP_EFFECT_PARTICLES, - DISABLE_INVENTORY_EFFECTS, - DISABLE_ITEM_SWITCH_COOLDOWN, - DISABLE_MOB_SPAWNER_MOB_RENDER, - DISABLE_NAUSEA_EFFECT, - DISABLE_NETHER_FOG, - DISABLE_NETHER_PORTAL_SOUND, - DISABLE_OBSERVER, - DISABLE_OFFHAND_RENDERING, - DISABLE_PARTICLES, - DISABLE_PORTAL_GUI_CLOSING, - DISABLE_RAIN_EFFECTS, - DISABLE_RENDERING_SCAFFOLDING, - DISABLE_RENDER_DISTANCE_FOG, - DISABLE_SCOREBOARD_RENDERING, - DISABLE_SHULKER_BOX_TOOLTIP, - DISABLE_SHOVEL_PATHING, - DISABLE_SIGN_GUI, - DISABLE_SKY_DARKNESS, - DISABLE_SLIME_BLOCK_SLOWDOWN, - DISABLE_STATUS_EFFECT_HUD, - DISABLE_TILE_ENTITY_RENDERING, - DISABLE_TILE_ENTITY_TICKING, - DISABLE_VILLAGER_TRADE_LOCKING, - DISABLE_WALL_UNSPRINT, - DISABLE_WORLD_VIEW_BOB); - } - - public static class Internal { - public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, - "This is just for the mod internally to track the\ncurrently selected fly speed preset"); - public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, - "The original gamma value, before the gamma override was enabled"); - public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger("hotbarScrollCurrentRow", 3, 0, - 3, - "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); - public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( - "slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); - public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, 135, - "The last snapped-to pitch value"); - public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, - "The last snapped-to yaw value"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - FLY_SPEED_PRESET, - GAMMA_VALUE_ORIGINAL, - HOTBAR_SCROLL_CURRENT_ROW, - SLIME_BLOCK_SLIPPERINESS_ORIGINAL, - SNAP_AIM_LAST_YAW); - } - - public static ConfigDouble getActiveFlySpeedConfig() { - switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { - case 0: - return Configs.Generic.FLY_SPEED_PRESET_1; - case 1: - return Configs.Generic.FLY_SPEED_PRESET_2; - case 2: - return Configs.Generic.FLY_SPEED_PRESET_3; - case 3: - return Configs.Generic.FLY_SPEED_PRESET_4; - default: - return Configs.Generic.FLY_SPEED_PRESET_1; + private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; + + public static class Generic { + public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger( + "afterClickerClickCount", 1, 1, + 32, + "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, + 64, + "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, + 64, + "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( + "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); + public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, + "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList( + "breakingRestrictionMode", + PlacementRestrictionMode.LINE, + "The Breaking Restriction mode to use (hotkey-selectable)"); + public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", + "#80000000", + "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); + public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", + "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); + public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( + "carpetAccuratePlacementProtocol", true, + "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); + public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean( + "clientPlacementRotation", true, + "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); + public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger( + "customInventoryGuiScale", 2, + 1, 10, + "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); + public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList( + "elytraCameraIndicator", + ActiveMode.WITH_KEY, + "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( + "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); + public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger( + "fastBlockPlacementCount", 2, + 1, 16, + "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); + public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean( + "fastLeftClickAllowTools", + false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); + public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, + 64, + "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); + public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( + "fastPlacementRememberOrientation", true, + "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); + public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, + 1, 64, + "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); + public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, + 1000000000, + "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); + public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( + "flexibleBlockPlacementOverlayColor", "#C03030F0", + "The color of the currently pointed-at\nregion in block placement the overlay"); + public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", + 0.4, 0.0, + 1.0, + "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); + public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, + "The fly speed for preset 1"); + public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, + "The fly speed for preset 2"); + public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, + "The fly speed for preset 3"); + public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, + "The fly speed for preset 4"); + public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean( + "freeCameraPlayerInputs", false, + "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); + public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean( + "freeCameraPlayerMovement", + false, + "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); + public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, + 32, + "The gamma value to use when the override option is enabled"); + public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, + "If enabled, then hand restocking happens\nbefore the stack runs out"); + public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger( + "handRestockPreThreshold", 6, + 1, 64, + "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); + public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( + "hangableEntityBypassInverse", false, + "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); + public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, + 9, + "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); + public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger( + "hotbarSlotRandomizerMax", 5, + 1, 9, + "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); + public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( + "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, + "The positioning of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger( + "hotbarSwapOverlayOffsetX", + 4, "The horizontal offset of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger( + "hotbarSwapOverlayOffsetY", + 4, "The vertical offset of the hotbar swap overlay"); + public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( + "itemSwapDurabilityThreshold", 20, 5, 10000, + "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); + public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean( + "itemUsePacketCheckBypass", + true, + "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); + public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, + "The size of the rendered map previews"); + public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", + 20, 0, + Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); + public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, + 0, + Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( + "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, + "The number of game ticks to hold down attack"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( + "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, + "The number of game ticks between starting to hold down attack (left click)"); + public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger( + "periodicHoldUseDuration", 20, + 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); + public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger( + "periodicHoldUseInterval", 20, + 0, Integer.MAX_VALUE, + "The number of game ticks between starting to hold down use (right click)"); + public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean( + "permanentSneakAllowInGUIs", + false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); + public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, + 1000, + "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, + "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( + "placementRestrictionMode", PlacementRestrictionMode.FACE, + "The Placement Restriction mode to use (hotkey-selectable)"); + public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( + "placementRestrictionTiedToFast", true, + "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); + public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( + "potionWarningBeneficialOnly", true, + "Only warn about potion effects running out that are marked as \"beneficial\""); + public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", + 600, 1, + 1000000, + "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); + public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", + true, + "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); + public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, + 10000, + "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, + 10000, + "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger( + "sculkSensorPulseLength", 40, 0, + 10000, + "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); + public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean( + "shulkerDisplayBgColor", + true, + "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); + public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( + "shulkerDisplayRequireShift", true, + "Whether or not holding shift is required for the Shulker Box preview"); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, + "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean( + "slotSyncWorkaroundAlways", + false, + "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); + public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, + "Whether or not to render the snap aim angle indicator"); + public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", + "#603030FF", + "The color for the snap aim indicator background"); + public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", + SnapAimMode.YAW, + "Snap aim mode: yaw, or pitch, or both"); + public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean( + "snapAimOnlyCloseToAngle", + true, + "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); + public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", + false, + "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); + public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, + "The pitch angle step of the snap aim tweak"); + public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", + 1.5, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, + "The yaw angle step of the snap aim tweak"); + public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", + 128, 1, + 256, "The maximum dimensions for a Structure Block's saved area"); + public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", + "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); + public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", + "", + "The slots where the Tool Switch tweak does not work when they are active."); + public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( + "zoomAdjustMouseSensitivity", true, + "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); + public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, + "The FOV value used for the zoom feature"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + CARPET_ACCURATE_PLACEMENT_PROTOCOL, + CLIENT_PLACEMENT_ROTATION, + FAST_LEFT_CLICK_ALLOW_TOOLS, + FAST_PLACEMENT_REMEMBER_ALWAYS, + FREE_CAMERA_PLAYER_INPUTS, + FREE_CAMERA_PLAYER_MOVEMENT, + HAND_RESTOCK_PRE, + HANGABLE_ENTITY_BYPASS_INVERSE, + ITEM_USE_PACKET_CHECK_BYPASS, + PERMANENT_SNEAK_ALLOW_IN_GUIS, + PLACEMENT_RESTRICTION_TIED_TO_FAST, + POTION_WARNING_BENEFICIAL_ONLY, + REMEMBER_FLEXIBLE, + SHULKER_DISPLAY_BACKGROUND_COLOR, + SHULKER_DISPLAY_REQUIRE_SHIFT, + SLOT_SYNC_WORKAROUND, + SLOT_SYNC_WORKAROUND_ALWAYS, + SNAP_AIM_INDICATOR, + SNAP_AIM_ONLY_CLOSE_TO_ANGLE, + SNAP_AIM_PITCH_OVERSHOOT, + ZOOM_ADJUST_MOUSE_SENSITIVITY, + + BLOCK_TYPE_BREAK_RESTRICTION_WARN, + BREAKING_RESTRICTION_MODE, + ELYTRA_CAMERA_INDICATOR, + ENTITY_TYPE_ATTACK_RESTRICTION_WARN, + PLACEMENT_RESTRICTION_MODE, + HOTBAR_SWAP_OVERLAY_ALIGNMENT, + SNAP_AIM_MODE, + + CHAT_TIME_FORMAT, + CHAT_BACKGROUND_COLOR, + FLEXIBLE_PLACEMENT_OVERLAY_COLOR, + SNAP_AIM_INDICATOR_COLOR, + + AFTER_CLICKER_CLICK_COUNT, + BLOCK_REACH_DISTANCE, + ENTITY_REACH_DISTANCE, + BREAKING_GRID_SIZE, + CUSTOM_INVENTORY_GUI_SCALE, + FAST_BLOCK_PLACEMENT_COUNT, + FAST_LEFT_CLICK_COUNT, + FAST_RIGHT_CLICK_COUNT, + FILL_CLONE_LIMIT, + FLY_DECELERATION_FACTOR, + FLY_SPEED_PRESET_1, + FLY_SPEED_PRESET_2, + FLY_SPEED_PRESET_3, + FLY_SPEED_PRESET_4, + GAMMA_OVERRIDE_VALUE, + HAND_RESTOCK_PRE_THRESHOLD, + HOTBAR_SLOT_CYCLE_MAX, + HOTBAR_SLOT_RANDOMIZER_MAX, + HOTBAR_SWAP_OVERLAY_OFFSET_X, + HOTBAR_SWAP_OVERLAY_OFFSET_Y, + ITEM_SWAP_DURABILITY_THRESHOLD, + MAP_PREVIEW_SIZE, + PERIODIC_ATTACK_INTERVAL, + PERIODIC_USE_INTERVAL, + PERIODIC_HOLD_ATTACK_DURATION, + PERIODIC_HOLD_ATTACK_INTERVAL, + PERIODIC_HOLD_USE_DURATION, + PERIODIC_HOLD_USE_INTERVAL, + PLACEMENT_GRID_SIZE, + PLACEMENT_LIMIT, + POTION_WARNING_THRESHOLD, + RENDER_LIMIT_ITEM, + RENDER_LIMIT_XP_ORB, + SCULK_SENSOR_PULSE_LENGTH, + SNAP_AIM_PITCH_STEP, + SNAP_AIM_THRESHOLD_PITCH, + SNAP_AIM_THRESHOLD_YAW, + SNAP_AIM_YAW_STEP, + STRUCTURE_BLOCK_MAX_SIZE, + TOOL_SWITCHABLE_SLOTS, + TOOL_SWITCH_IGNORED_SLOTS, + ZOOM_FOV); } - } - public static void loadFromFile() { - File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); + public static class Fixes { + public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, + "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); + public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", + false, + "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); + public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( + "ravagerClientBlockBreakFix", false, + "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + ELYTRA_FIX, + MAC_HORIZONTAL_SCROLL, + RAVAGER_CLIENT_BLOCK_BREAK_FIX); + } - if (configFile.exists() && configFile.isFile() && configFile.canRead()) { - JsonElement element = JsonUtils.parseJsonFile(configFile); + public static class Lists { + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "blockTypeBreakRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Block Type Break Restriction tweak"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( + "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), + "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( + "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), + "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); + public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", + ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", + "minecraft:repeating_command_block", "minecraft:dragon_egg", + "minecraft:structure_void", + "minecraft:structure_block", + "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), + "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "entityTypeAttackRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Entity Type Attack Restriction tweak"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( + "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), + "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( + "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), + "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", + ImmutableList.of( + " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", + "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", + "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), + "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); + public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( + "fastPlacementItemListType", ListType.BLACKLIST, + "The item restriction type for the Fast Block Placement tweak"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( + "fastPlacementItemBlackList", + ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), + "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( + "fastPlacementItemWhiteList", ImmutableList.of(), + "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( + "fastRightClickBlockListType", ListType.BLACKLIST, + "The targeted block restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( + "fastRightClickBlockBlackList", + ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", + "minecraft:white_shulker_box"), + "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( + "fastRightClickBlockWhiteList", ImmutableList.of(), + "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( + "fastRightClickListType", ListType.NONE, + "The item restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( + "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), + "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( + "fastRightClickWhiteList", + ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", + "minecraft:glass_bottle"), + "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); + public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", + ImmutableList.of( + "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", + "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), + "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); + public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList( + "handRestockListType", + ListType.NONE, "The restriction list type for the Hand Restock tweak"); + public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList( + "handRestockBlackList", + ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), + "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); + public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList( + "handRestockWhiteList", + ImmutableList.of(), + "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); + public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList( + "potionWarningListType", + ListType.NONE, "The list type for potion warning effects"); + public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList( + "potionWarningBlackList", + ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", + "minecraft:poison", + "minecraft:slowness", "minecraft:weakness"), + "The potion effects that will not be warned about"); + public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList( + "potionWarningWhiteList", + ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", + "minecraft:water_breathing"), + "The only potion effects that will be warned about"); + public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", + ImmutableList.of("mainhand", "offhand"), + "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); + public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", + ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), + "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, + BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST, + BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST, + CREATIVE_EXTRA_ITEMS, + ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE, + ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST, + ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST, + ENTITY_WEAPON_MAPPING, + FAST_PLACEMENT_ITEM_LIST_TYPE, + FAST_RIGHT_CLICK_BLOCK_LIST_TYPE, + FAST_RIGHT_CLICK_ITEM_LIST_TYPE, + POTION_WARNING_LIST_TYPE, + FAST_PLACEMENT_ITEM_BLACKLIST, + FAST_PLACEMENT_ITEM_WHITELIST, + FAST_RIGHT_CLICK_BLOCK_BLACKLIST, + FAST_RIGHT_CLICK_BLOCK_WHITELIST, + FAST_RIGHT_CLICK_ITEM_BLACKLIST, + FAST_RIGHT_CLICK_ITEM_WHITELIST, + FLAT_WORLD_PRESETS, + HAND_RESTOCK_LIST_TYPE, + HAND_RESTOCK_BLACKLIST, + HAND_RESTOCK_WHITELIST, + POTION_WARNING_BLACKLIST, + POTION_WARNING_WHITELIST, + REPAIR_MODE_SLOTS, + UNSTACKING_ITEMS); + } - if (element != null && element.isJsonObject()) { - JsonObject root = element.getAsJsonObject(); + public static class Disable { + public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( + "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); + public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( + "disableAxeStripping", false, "", "Disables stripping logs with an axe"); + public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient( + "disableBatSpawning", + false, "", "Disables Bat spawning in single player"); + public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( + "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( + "disableBlockBreakingParticles", false, "", + "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( + "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", + false, + "", "Disables boss bar rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", + false, + "", "Removes the fog that boss mobs cause"); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( + "disableChunkRendering", false, "", + "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( + "disableClientEntityUpdates", false, "", + "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( + "disableClientLightUpdates", false, "", "Disables all client-side light updates"); + public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( + "disableConstantChunkSaving", false, "", + "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); + public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( + "disableCreativeMenuInfestedBlocks", false, "", + "Removes infested stone blocks from the creative search inventory"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( + "disableDeadMobRendering", false, "", + "Prevents rendering dead mobs (entities that are at 0 health)"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( + "disableDeadMobTargeting", false, "", + "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableEntityRendering", false, "", + "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( + "disableEntityTicking", false, "", + "Prevent everything except player entities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( + "disableFallingBlockEntityRendering", false, "", + "If enabled, then falling block entities won't be rendered at all"); + public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( + "disableFirstPersonEffectParticles", false, "", + "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); + public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( + "disableInventoryEffectRendering", false, "", + "Removes the potion effect rendering from the inventory GUIs"); + public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( + "disableItemSwitchRenderCooldown", false, "", + "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); + public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( + "disableMobSpawnerMobRendering", false, "", + "Removes the entity rendering from mob spawners"); + public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( + "disableNauseaEffect", false, "", "Disables the nausea visual effects"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed( + "disableNetherFog", + false, "", "Removes the fog in the Nether"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( + "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); + public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", + false, + "", "Disable Observers from triggering at all"); + public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( + "disableOffhandRendering", false, "", + "Disables the offhand item from getting rendered"); + public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed( + "disableParticles", + false, "", "Disables all particles"); + public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( + "disablePortalGuiClosing", false, "", + "If enabled, then you can still open GUIs while in a Nether Portal"); + public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed( + "disableRainEffects", + false, "", "Disables rain rendering and sounds"); + public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( + "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); + public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( + "disableRenderDistanceFog", false, "", + "Disables the fog that increases around the render distance"); + public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( + "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); + public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( + "disableShulkerBoxTooltip", false, "", + "Disables the vanilla text tooltip for Shulker Box contents"); + public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( + "disableShovelPathing", false, "", + "Disables converting grass etc. to Path Blocks with a shovel"); + public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", + false, + "", "Prevent the Sign edit GUI from opening"); + public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed( + "disableSkyDarkness", + false, "", + "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); + public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( + "disableSlimeBlockSlowdown", false, "", + "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( + "disableStatusEffectHud", false, "", + "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableTileEntityRendering", false, "", + "Prevents all TileEntity renderers from rendering"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( + "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( + "disableVillagerTradeLocking", false, "", + "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); + public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( + "disableWallUnsprint", false, "", + "Touching a wall doesn't drop you out from sprint mode"); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( + "disableWorldViewBob", false, "", + "Disables the view bob wobble effect of the world, but not the hand"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + DISABLE_ARMOR_STAND_RENDERING, + DISABLE_AXE_STRIPPING, + DISABLE_BAT_SPAWNING, + DISABLE_BEACON_BEAM_RENDERING, + DISABLE_BLOCK_BREAK_PARTICLES, + DISABLE_DOUBLE_TAP_SPRINT, + DISABLE_BOSS_BAR, + DISABLE_BOSS_FOG, + DISABLE_CHUNK_RENDERING, + DISABLE_CLIENT_ENTITY_UPDATES, + DISABLE_CLIENT_LIGHT_UPDATES, + DISABLE_CONSTANT_CHUNK_SAVING, + DISABLE_CREATIVE_INFESTED_BLOCKS, + DISABLE_DEAD_MOB_RENDERING, + DISABLE_DEAD_MOB_TARGETING, + DISABLE_ENTITY_RENDERING, + DISABLE_ENTITY_TICKING, + DISABLE_FALLING_BLOCK_RENDER, + DISABLE_FP_EFFECT_PARTICLES, + DISABLE_INVENTORY_EFFECTS, + DISABLE_ITEM_SWITCH_COOLDOWN, + DISABLE_MOB_SPAWNER_MOB_RENDER, + DISABLE_NAUSEA_EFFECT, + DISABLE_NETHER_FOG, + DISABLE_NETHER_PORTAL_SOUND, + DISABLE_OBSERVER, + DISABLE_OFFHAND_RENDERING, + DISABLE_PARTICLES, + DISABLE_PORTAL_GUI_CLOSING, + DISABLE_RAIN_EFFECTS, + DISABLE_RENDERING_SCAFFOLDING, + DISABLE_RENDER_DISTANCE_FOG, + DISABLE_SCOREBOARD_RENDERING, + DISABLE_SHULKER_BOX_TOOLTIP, + DISABLE_SHOVEL_PATHING, + DISABLE_SIGN_GUI, + DISABLE_SKY_DARKNESS, + DISABLE_SLIME_BLOCK_SLOWDOWN, + DISABLE_STATUS_EFFECT_HUD, + DISABLE_TILE_ENTITY_RENDERING, + DISABLE_TILE_ENTITY_TICKING, + DISABLE_VILLAGER_TRADE_LOCKING, + DISABLE_WALL_UNSPRINT, + DISABLE_WORLD_VIEW_BOB); + } - ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); - ConfigUtils.readConfigBase(root, "Generic", Configs.Generic.OPTIONS); - ConfigUtils.readConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); - ConfigUtils.readConfigBase(root, "Internal", Configs.Internal.OPTIONS); - ConfigUtils.readConfigBase(root, "Lists", Configs.Lists.OPTIONS); - ConfigUtils.readHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); - ConfigUtils.readHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", FeatureToggle.VALUES); - } + public static class Internal { + public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, + "This is just for the mod internally to track the\ncurrently selected fly speed preset"); + public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, + "The original gamma value, before the gamma override was enabled"); + public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger( + "hotbarScrollCurrentRow", 3, 0, + 3, + "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); + public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( + "slimeBlockSlipperinessOriginal", 0.8, 0, 1, + "The original slipperiness value of Slime Blocks"); + public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, + 135, + "The last snapped-to pitch value"); + public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, + "The last snapped-to yaw value"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + FLY_SPEED_PRESET, + GAMMA_VALUE_ORIGINAL, + HOTBAR_SCROLL_CURRENT_ROW, + SLIME_BLOCK_SLIPPERINESS_ORIGINAL, + SNAP_AIM_LAST_YAW); } - // TODO 1.19.3+ - // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); - - InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); - InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); - InventoryUtils.setRepairModeSlots(Lists.REPAIR_MODE_SLOTS.getStrings()); - InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); - InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); - - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION - .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( - Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), - Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); - - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( - Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), - Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); - - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( - Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), - Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); - - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( - Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), - Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); - - PlacementTweaks.HAND_RESTOCK_RESTRICTION - .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); - PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( - Lists.HAND_RESTOCK_BLACKLIST.getStrings(), - Lists.HAND_RESTOCK_WHITELIST.getStrings()); - - MiscTweaks.POTION_RESTRICTION.setListType((ListType) Lists.POTION_WARNING_LIST_TYPE.getOptionListValue()); - MiscTweaks.POTION_RESTRICTION.setListContents( - Lists.POTION_WARNING_BLACKLIST.getStrings(), - Lists.POTION_WARNING_WHITELIST.getStrings()); - - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION - .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( - Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), - Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); - - if (MinecraftClient.getInstance().world == null) { - // Turn off after loading the configs, just in case it was enabled in the config - // somehow. - // But only if we are currently not in a world, since changing configs also - // re-loads them when closing the menu. - FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); + public static ConfigDouble getActiveFlySpeedConfig() { + switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { + case 0: + return Configs.Generic.FLY_SPEED_PRESET_1; + case 1: + return Configs.Generic.FLY_SPEED_PRESET_2; + case 2: + return Configs.Generic.FLY_SPEED_PRESET_3; + case 3: + return Configs.Generic.FLY_SPEED_PRESET_4; + default: + return Configs.Generic.FLY_SPEED_PRESET_1; + } } - } - public static void saveToFile() { - File dir = FileUtils.getConfigDirectory(); + public static void loadFromFile() { + File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); + + if (configFile.exists() && configFile.isFile() && configFile.canRead()) { + JsonElement element = JsonUtils.parseJsonFile(configFile); + + if (element != null && element.isJsonObject()) { + JsonObject root = element.getAsJsonObject(); + + ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); + ConfigUtils.readConfigBase(root, "Generic", Configs.Generic.OPTIONS); + ConfigUtils.readConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); + ConfigUtils.readConfigBase(root, "Internal", Configs.Internal.OPTIONS); + ConfigUtils.readConfigBase(root, "Lists", Configs.Lists.OPTIONS); + ConfigUtils.readHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", + Disable.OPTIONS); + ConfigUtils.readHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", + FeatureToggle.VALUES); + } + } + + // TODO 1.19.3+ + // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); + + InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); + InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); + InventoryUtils.setRepairModeSlots(Lists.REPAIR_MODE_SLOTS.getStrings()); + InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); + InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); + + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION + .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE + .getOptionListValue()); + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( + Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), + Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); + + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( + Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), + Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); + + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( + Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), + Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); + + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( + Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), + Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); + + PlacementTweaks.HAND_RESTOCK_RESTRICTION + .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( + Lists.HAND_RESTOCK_BLACKLIST.getStrings(), + Lists.HAND_RESTOCK_WHITELIST.getStrings()); + + MiscTweaks.POTION_RESTRICTION + .setListType((ListType) Lists.POTION_WARNING_LIST_TYPE.getOptionListValue()); + MiscTweaks.POTION_RESTRICTION.setListContents( + Lists.POTION_WARNING_BLACKLIST.getStrings(), + Lists.POTION_WARNING_WHITELIST.getStrings()); + + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION + .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE + .getOptionListValue()); + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( + Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), + Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); + + MinecraftClient ci = MinecraftClient.getInstance(); // Makes warnings go away + if (ci.world == null) { + // Turn off after loading the configs, just in case it was enabled in the config + // somehow. + // But only if we are currently not in a world, since changing configs also + // re-loads them when closing the menu. + FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); + } + } - if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { - JsonObject root = new JsonObject(); + public static void saveToFile() { + File dir = FileUtils.getConfigDirectory(); - ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); - ConfigUtils.writeConfigBase(root, "Generic", Configs.Generic.OPTIONS); - ConfigUtils.writeConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); - ConfigUtils.writeConfigBase(root, "Internal", Configs.Internal.OPTIONS); - ConfigUtils.writeConfigBase(root, "Lists", Configs.Lists.OPTIONS); - ConfigUtils.writeHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); - ConfigUtils.writeHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", FeatureToggle.VALUES); + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { + JsonObject root = new JsonObject(); - JsonUtils.writeJsonToFile(root, new File(dir, CONFIG_FILE_NAME)); + ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); + ConfigUtils.writeConfigBase(root, "Generic", Configs.Generic.OPTIONS); + ConfigUtils.writeConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); + ConfigUtils.writeConfigBase(root, "Internal", Configs.Internal.OPTIONS); + ConfigUtils.writeConfigBase(root, "Lists", Configs.Lists.OPTIONS); + ConfigUtils.writeHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); + ConfigUtils.writeHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", + FeatureToggle.VALUES); + + JsonUtils.writeJsonToFile(root, new File(dir, CONFIG_FILE_NAME)); + } } - } - @Override - public void load() { - loadFromFile(); - } + @Override + public void load() { + loadFromFile(); + } - @Override - public void save() { - saveToFile(); - } + @Override + public void save() { + saveToFile(); + } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 2ed9955c2..0c0a929a1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -41,16 +41,16 @@ private boolean fakeSneaking(PlayerEntity entity) { } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideBlockReachDistance(CallbackInfoReturnable cir) { + private void overrideBlockReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideEntityReachDistance(CallbackInfoReturnable cir) { + private void overrideEntityReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue((float) Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d1f609b8b..0d0a924cf 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,6 +34,6 @@ "depends": { "minecraft": ">=1.20.4", - "malilib": ">=0.19.0" + "malilib": ">=0.19.0-snap" } } From 5e31dd5d76f29a4d25ffb02eaf03ca7bae9b3f7c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:15:51 -0500 Subject: [PATCH 003/128] 1.20.x revert --- .../fi/dy/masa/tweakeroo/config/Configs.java | 1434 ++++++++--------- .../masa/tweakeroo/config/FeatureToggle.java | 360 ++--- .../MixinClientPlayerInteractionManager.java | 185 ++- .../masa/tweakeroo/mixin/MixinInGameHud.java | 62 +- .../tweakeroo/mixin/MixinPlayerEntity.java | 8 +- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 212 ++- .../tweakeroo/tweaks/PlacementTweaks.java | 937 ++++++----- .../masa/tweakeroo/util/InventoryUtils.java | 780 +++++---- 8 files changed, 2076 insertions(+), 1902 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 8c8e191c0..9f01acd65 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -33,783 +33,689 @@ import net.minecraft.client.MinecraftClient; public class Configs implements IConfigHandler { - private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; - - public static class Generic { - public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger( - "afterClickerClickCount", 1, 1, - 32, - "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, - 64, - "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, - 64, - "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( - "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); - public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, - "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList( - "breakingRestrictionMode", - PlacementRestrictionMode.LINE, - "The Breaking Restriction mode to use (hotkey-selectable)"); - public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", - "#80000000", - "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); - public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", - "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); - public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( - "carpetAccuratePlacementProtocol", true, - "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); - public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean( - "clientPlacementRotation", true, - "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); - public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger( - "customInventoryGuiScale", 2, - 1, 10, - "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); - public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList( - "elytraCameraIndicator", - ActiveMode.WITH_KEY, - "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( - "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); - public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger( - "fastBlockPlacementCount", 2, - 1, 16, - "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); - public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean( - "fastLeftClickAllowTools", - false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); - public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, - 64, - "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); - public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( - "fastPlacementRememberOrientation", true, - "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); - public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, - 1, 64, - "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); - public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, - 1000000000, - "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); - public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( - "flexibleBlockPlacementOverlayColor", "#C03030F0", - "The color of the currently pointed-at\nregion in block placement the overlay"); - public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", - 0.4, 0.0, - 1.0, - "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); - public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, - "The fly speed for preset 1"); - public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, - "The fly speed for preset 2"); - public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, - "The fly speed for preset 3"); - public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, - "The fly speed for preset 4"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean( - "freeCameraPlayerInputs", false, - "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); - public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean( - "freeCameraPlayerMovement", - false, - "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); - public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, - 32, - "The gamma value to use when the override option is enabled"); - public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, - "If enabled, then hand restocking happens\nbefore the stack runs out"); - public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger( - "handRestockPreThreshold", 6, - 1, 64, - "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); - public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( - "hangableEntityBypassInverse", false, - "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); - public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, - 9, - "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); - public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger( - "hotbarSlotRandomizerMax", 5, - 1, 9, - "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); - public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( - "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, - "The positioning of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger( - "hotbarSwapOverlayOffsetX", - 4, "The horizontal offset of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger( - "hotbarSwapOverlayOffsetY", - 4, "The vertical offset of the hotbar swap overlay"); - public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( - "itemSwapDurabilityThreshold", 20, 5, 10000, - "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); - public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean( - "itemUsePacketCheckBypass", - true, - "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); - public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, - "The size of the rendered map previews"); - public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", - 20, 0, - Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); - public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, - 0, - Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( - "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, - "The number of game ticks to hold down attack"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( - "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, - "The number of game ticks between starting to hold down attack (left click)"); - public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger( - "periodicHoldUseDuration", 20, - 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); - public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger( - "periodicHoldUseInterval", 20, - 0, Integer.MAX_VALUE, - "The number of game ticks between starting to hold down use (right click)"); - public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean( - "permanentSneakAllowInGUIs", - false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); - public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, - 1000, - "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, - "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( - "placementRestrictionMode", PlacementRestrictionMode.FACE, - "The Placement Restriction mode to use (hotkey-selectable)"); - public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( - "placementRestrictionTiedToFast", true, - "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); - public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( - "potionWarningBeneficialOnly", true, - "Only warn about potion effects running out that are marked as \"beneficial\""); - public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", - 600, 1, - 1000000, - "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); - public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", - true, - "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); - public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, - 10000, - "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, - 10000, - "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger( - "sculkSensorPulseLength", 40, 0, - 10000, - "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); - public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean( - "shulkerDisplayBgColor", - true, - "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); - public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( - "shulkerDisplayRequireShift", true, - "Whether or not holding shift is required for the Shulker Box preview"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, - "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean( - "slotSyncWorkaroundAlways", - false, - "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); - public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, - "Whether or not to render the snap aim angle indicator"); - public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", - "#603030FF", - "The color for the snap aim indicator background"); - public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", - SnapAimMode.YAW, - "Snap aim mode: yaw, or pitch, or both"); - public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean( - "snapAimOnlyCloseToAngle", - true, - "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); - public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", - false, - "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); - public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, - "The pitch angle step of the snap aim tweak"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", - 1.5, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, - "The yaw angle step of the snap aim tweak"); - public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", - 128, 1, - 256, "The maximum dimensions for a Structure Block's saved area"); - public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", - "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); - public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", - "", - "The slots where the Tool Switch tweak does not work when they are active."); - public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( - "zoomAdjustMouseSensitivity", true, - "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); - public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, - "The FOV value used for the zoom feature"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - CARPET_ACCURATE_PLACEMENT_PROTOCOL, - CLIENT_PLACEMENT_ROTATION, - FAST_LEFT_CLICK_ALLOW_TOOLS, - FAST_PLACEMENT_REMEMBER_ALWAYS, - FREE_CAMERA_PLAYER_INPUTS, - FREE_CAMERA_PLAYER_MOVEMENT, - HAND_RESTOCK_PRE, - HANGABLE_ENTITY_BYPASS_INVERSE, - ITEM_USE_PACKET_CHECK_BYPASS, - PERMANENT_SNEAK_ALLOW_IN_GUIS, - PLACEMENT_RESTRICTION_TIED_TO_FAST, - POTION_WARNING_BENEFICIAL_ONLY, - REMEMBER_FLEXIBLE, - SHULKER_DISPLAY_BACKGROUND_COLOR, - SHULKER_DISPLAY_REQUIRE_SHIFT, - SLOT_SYNC_WORKAROUND, - SLOT_SYNC_WORKAROUND_ALWAYS, - SNAP_AIM_INDICATOR, - SNAP_AIM_ONLY_CLOSE_TO_ANGLE, - SNAP_AIM_PITCH_OVERSHOOT, - ZOOM_ADJUST_MOUSE_SENSITIVITY, - - BLOCK_TYPE_BREAK_RESTRICTION_WARN, - BREAKING_RESTRICTION_MODE, - ELYTRA_CAMERA_INDICATOR, - ENTITY_TYPE_ATTACK_RESTRICTION_WARN, - PLACEMENT_RESTRICTION_MODE, - HOTBAR_SWAP_OVERLAY_ALIGNMENT, - SNAP_AIM_MODE, - - CHAT_TIME_FORMAT, - CHAT_BACKGROUND_COLOR, - FLEXIBLE_PLACEMENT_OVERLAY_COLOR, - SNAP_AIM_INDICATOR_COLOR, - - AFTER_CLICKER_CLICK_COUNT, - BLOCK_REACH_DISTANCE, - ENTITY_REACH_DISTANCE, - BREAKING_GRID_SIZE, - CUSTOM_INVENTORY_GUI_SCALE, - FAST_BLOCK_PLACEMENT_COUNT, - FAST_LEFT_CLICK_COUNT, - FAST_RIGHT_CLICK_COUNT, - FILL_CLONE_LIMIT, - FLY_DECELERATION_FACTOR, - FLY_SPEED_PRESET_1, - FLY_SPEED_PRESET_2, - FLY_SPEED_PRESET_3, - FLY_SPEED_PRESET_4, - GAMMA_OVERRIDE_VALUE, - HAND_RESTOCK_PRE_THRESHOLD, - HOTBAR_SLOT_CYCLE_MAX, - HOTBAR_SLOT_RANDOMIZER_MAX, - HOTBAR_SWAP_OVERLAY_OFFSET_X, - HOTBAR_SWAP_OVERLAY_OFFSET_Y, - ITEM_SWAP_DURABILITY_THRESHOLD, - MAP_PREVIEW_SIZE, - PERIODIC_ATTACK_INTERVAL, - PERIODIC_USE_INTERVAL, - PERIODIC_HOLD_ATTACK_DURATION, - PERIODIC_HOLD_ATTACK_INTERVAL, - PERIODIC_HOLD_USE_DURATION, - PERIODIC_HOLD_USE_INTERVAL, - PLACEMENT_GRID_SIZE, - PLACEMENT_LIMIT, - POTION_WARNING_THRESHOLD, - RENDER_LIMIT_ITEM, - RENDER_LIMIT_XP_ORB, - SCULK_SENSOR_PULSE_LENGTH, - SNAP_AIM_PITCH_STEP, - SNAP_AIM_THRESHOLD_PITCH, - SNAP_AIM_THRESHOLD_YAW, - SNAP_AIM_YAW_STEP, - STRUCTURE_BLOCK_MAX_SIZE, - TOOL_SWITCHABLE_SLOTS, - TOOL_SWITCH_IGNORED_SLOTS, - ZOOM_FOV); + private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; + + public static class Generic { + public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger("afterClickerClickCount", 1, 1, + 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, 64, + "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, 64, + "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( + "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); + public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, + "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList("breakingRestrictionMode", + PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); + public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", "#80000000", + "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); + public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", + "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); + public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( + "carpetAccuratePlacementProtocol", true, + "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); + public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean("clientPlacementRotation", true, + "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); + public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger("customInventoryGuiScale", 2, + 1, 10, + "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); + public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList("elytraCameraIndicator", + ActiveMode.WITH_KEY, + "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( + "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, + "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); + public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger("fastBlockPlacementCount", 2, + 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); + public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean("fastLeftClickAllowTools", + false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); + public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, 64, + "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); + public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( + "fastPlacementRememberOrientation", true, + "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); + public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, 1, 64, + "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); + public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, + 1000000000, + "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); + public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( + "flexibleBlockPlacementOverlayColor", "#C03030F0", + "The color of the currently pointed-at\nregion in block placement the overlay"); + public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", 0.4, 0.0, + 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); + public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, + "The fly speed for preset 1"); + public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, + "The fly speed for preset 2"); + public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, + "The fly speed for preset 3"); + public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, + "The fly speed for preset 4"); + public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean("freeCameraPlayerInputs", false, + "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); + public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean("freeCameraPlayerMovement", + false, + "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); + public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, 32, + "The gamma value to use when the override option is enabled"); + public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, + "If enabled, then hand restocking happens\nbefore the stack runs out"); + public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger("handRestockPreThreshold", 6, + 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); + public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( + "hangableEntityBypassInverse", false, + "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); + public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, 9, + "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); + public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger("hotbarSlotRandomizerMax", 5, + 1, 9, + "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); + public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( + "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger("hotbarSwapOverlayOffsetX", + 4, "The horizontal offset of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger("hotbarSwapOverlayOffsetY", + 4, "The vertical offset of the hotbar swap overlay"); + public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( + "itemSwapDurabilityThreshold", 20, 5, 10000, + "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); + public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean("itemUsePacketCheckBypass", + true, + "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); + public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, + "The size of the rendered map previews"); + public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", 20, 0, + Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); + public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, 0, + Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( + "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( + "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, + "The number of game ticks between starting to hold down attack (left click)"); + public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger("periodicHoldUseDuration", 20, + 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); + public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger("periodicHoldUseInterval", 20, + 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); + public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean("permanentSneakAllowInGUIs", + false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); + public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, 1000, + "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, + "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( + "placementRestrictionMode", PlacementRestrictionMode.FACE, + "The Placement Restriction mode to use (hotkey-selectable)"); + public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( + "placementRestrictionTiedToFast", true, + "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); + public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( + "potionWarningBeneficialOnly", true, + "Only warn about potion effects running out that are marked as \"beneficial\""); + public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", 600, 1, + 1000000, + "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); + public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", true, + "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); + public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, 10000, + "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, 10000, + "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger("sculkSensorPulseLength", 40, 0, + 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); + public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean("shulkerDisplayBgColor", + true, + "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); + public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( + "shulkerDisplayRequireShift", true, + "Whether or not holding shift is required for the Shulker Box preview"); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, + "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean("slotSyncWorkaroundAlways", + false, + "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); + public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, + "Whether or not to render the snap aim angle indicator"); + public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", "#603030FF", + "The color for the snap aim indicator background"); + public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", SnapAimMode.YAW, + "Snap aim mode: yaw, or pitch, or both"); + public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean("snapAimOnlyCloseToAngle", + true, + "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); + public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", false, + "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); + public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, + "The pitch angle step of the snap aim tweak"); + public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", 1.5, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, + "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, + "The yaw angle step of the snap aim tweak"); + public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", 128, 1, + 256, "The maximum dimensions for a Structure Block's saved area"); + public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", + "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); + public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", "", + "The slots where the Tool Switch tweak does not work when they are active."); + public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( + "zoomAdjustMouseSensitivity", true, + "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); + public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, + "The FOV value used for the zoom feature"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + CARPET_ACCURATE_PLACEMENT_PROTOCOL, + CLIENT_PLACEMENT_ROTATION, + FAST_LEFT_CLICK_ALLOW_TOOLS, + FAST_PLACEMENT_REMEMBER_ALWAYS, + FREE_CAMERA_PLAYER_INPUTS, + FREE_CAMERA_PLAYER_MOVEMENT, + HAND_RESTOCK_PRE, + HANGABLE_ENTITY_BYPASS_INVERSE, + ITEM_USE_PACKET_CHECK_BYPASS, + PERMANENT_SNEAK_ALLOW_IN_GUIS, + PLACEMENT_RESTRICTION_TIED_TO_FAST, + POTION_WARNING_BENEFICIAL_ONLY, + REMEMBER_FLEXIBLE, + SHULKER_DISPLAY_BACKGROUND_COLOR, + SHULKER_DISPLAY_REQUIRE_SHIFT, + SLOT_SYNC_WORKAROUND, + SLOT_SYNC_WORKAROUND_ALWAYS, + SNAP_AIM_INDICATOR, + SNAP_AIM_ONLY_CLOSE_TO_ANGLE, + SNAP_AIM_PITCH_OVERSHOOT, + ZOOM_ADJUST_MOUSE_SENSITIVITY, + + BLOCK_TYPE_BREAK_RESTRICTION_WARN, + BREAKING_RESTRICTION_MODE, + ELYTRA_CAMERA_INDICATOR, + ENTITY_TYPE_ATTACK_RESTRICTION_WARN, + PLACEMENT_RESTRICTION_MODE, + HOTBAR_SWAP_OVERLAY_ALIGNMENT, + SNAP_AIM_MODE, + + CHAT_TIME_FORMAT, + CHAT_BACKGROUND_COLOR, + FLEXIBLE_PLACEMENT_OVERLAY_COLOR, + SNAP_AIM_INDICATOR_COLOR, + + AFTER_CLICKER_CLICK_COUNT, + BLOCK_REACH_DISTANCE, + BREAKING_GRID_SIZE, + CUSTOM_INVENTORY_GUI_SCALE, + FAST_BLOCK_PLACEMENT_COUNT, + FAST_LEFT_CLICK_COUNT, + FAST_RIGHT_CLICK_COUNT, + FILL_CLONE_LIMIT, + FLY_DECELERATION_FACTOR, + FLY_SPEED_PRESET_1, + FLY_SPEED_PRESET_2, + FLY_SPEED_PRESET_3, + FLY_SPEED_PRESET_4, + GAMMA_OVERRIDE_VALUE, + HAND_RESTOCK_PRE_THRESHOLD, + HOTBAR_SLOT_CYCLE_MAX, + HOTBAR_SLOT_RANDOMIZER_MAX, + HOTBAR_SWAP_OVERLAY_OFFSET_X, + HOTBAR_SWAP_OVERLAY_OFFSET_Y, + ITEM_SWAP_DURABILITY_THRESHOLD, + MAP_PREVIEW_SIZE, + PERIODIC_ATTACK_INTERVAL, + PERIODIC_USE_INTERVAL, + PERIODIC_HOLD_ATTACK_DURATION, + PERIODIC_HOLD_ATTACK_INTERVAL, + PERIODIC_HOLD_USE_DURATION, + PERIODIC_HOLD_USE_INTERVAL, + PLACEMENT_GRID_SIZE, + PLACEMENT_LIMIT, + POTION_WARNING_THRESHOLD, + RENDER_LIMIT_ITEM, + RENDER_LIMIT_XP_ORB, + SCULK_SENSOR_PULSE_LENGTH, + SNAP_AIM_PITCH_STEP, + SNAP_AIM_THRESHOLD_PITCH, + SNAP_AIM_THRESHOLD_YAW, + SNAP_AIM_YAW_STEP, + STRUCTURE_BLOCK_MAX_SIZE, + TOOL_SWITCHABLE_SLOTS, + TOOL_SWITCH_IGNORED_SLOTS, + ZOOM_FOV); + } + + public static class Fixes { + public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, + "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); + public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, + "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); + public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( + "ravagerClientBlockBreakFix", false, + "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + ELYTRA_FIX, + MAC_HORIZONTAL_SCROLL, + RAVAGER_CLIENT_BLOCK_BREAK_FIX); + } + + public static class Lists { + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "blockTypeBreakRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Block Type Break Restriction tweak"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( + "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), + "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( + "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), + "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); + public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", + ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", + "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", + "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", + "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), + "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( + "entityTypeAttackRestrictionListType", ListType.BLACKLIST, + "The restriction list type for the Entity Type Attack Restriction tweak"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( + "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), + "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( + "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), + "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", + ImmutableList.of( + " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", + "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", + "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), + "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); + public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( + "fastPlacementItemListType", ListType.BLACKLIST, + "The item restriction type for the Fast Block Placement tweak"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( + "fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), + "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( + "fastPlacementItemWhiteList", ImmutableList.of(), + "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( + "fastRightClickBlockListType", ListType.BLACKLIST, + "The targeted block restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( + "fastRightClickBlockBlackList", + ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", + "minecraft:white_shulker_box"), + "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( + "fastRightClickBlockWhiteList", ImmutableList.of(), + "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( + "fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( + "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), + "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( + "fastRightClickWhiteList", + ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", + "minecraft:glass_bottle"), + "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); + public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", + ImmutableList.of( + "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", + "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), + "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); + public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", + ListType.NONE, "The restriction list type for the Hand Restock tweak"); + public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", + ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), + "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); + public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", + ImmutableList.of(), + "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); + public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", + ListType.NONE, "The list type for potion warning effects"); + public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", + ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", + "minecraft:slowness", "minecraft:weakness"), + "The potion effects that will not be warned about"); + public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", + ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), + "The only potion effects that will be warned about"); + public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", + ImmutableList.of("mainhand", "offhand"), + "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); + public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", + ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), + "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, + BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST, + BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST, + CREATIVE_EXTRA_ITEMS, + ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE, + ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST, + ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST, + ENTITY_WEAPON_MAPPING, + FAST_PLACEMENT_ITEM_LIST_TYPE, + FAST_RIGHT_CLICK_BLOCK_LIST_TYPE, + FAST_RIGHT_CLICK_ITEM_LIST_TYPE, + POTION_WARNING_LIST_TYPE, + FAST_PLACEMENT_ITEM_BLACKLIST, + FAST_PLACEMENT_ITEM_WHITELIST, + FAST_RIGHT_CLICK_BLOCK_BLACKLIST, + FAST_RIGHT_CLICK_BLOCK_WHITELIST, + FAST_RIGHT_CLICK_ITEM_BLACKLIST, + FAST_RIGHT_CLICK_ITEM_WHITELIST, + FLAT_WORLD_PRESETS, + HAND_RESTOCK_LIST_TYPE, + HAND_RESTOCK_BLACKLIST, + HAND_RESTOCK_WHITELIST, + POTION_WARNING_BLACKLIST, + POTION_WARNING_WHITELIST, + REPAIR_MODE_SLOTS, + UNSTACKING_ITEMS); + } + + public static class Disable { + public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( + "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); + public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( + "disableAxeStripping", false, "", "Disables stripping logs with an axe"); + public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient("disableBatSpawning", + false, "", "Disables Bat spawning in single player"); + public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( + "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( + "disableBlockBreakingParticles", false, "", + "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( + "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, + "", "Disables boss bar rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, + "", "Removes the fog that boss mobs cause"); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( + "disableChunkRendering", false, "", + "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( + "disableClientEntityUpdates", false, "", + "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( + "disableClientLightUpdates", false, "", "Disables all client-side light updates"); + public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( + "disableConstantChunkSaving", false, "", + "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); + public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( + "disableCreativeMenuInfestedBlocks", false, "", + "Removes infested stone blocks from the creative search inventory"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( + "disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( + "disableDeadMobTargeting", false, "", + "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableEntityRendering", false, "", + "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( + "disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( + "disableFallingBlockEntityRendering", false, "", + "If enabled, then falling block entities won't be rendered at all"); + public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( + "disableFirstPersonEffectParticles", false, "", + "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); + public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( + "disableInventoryEffectRendering", false, "", + "Removes the potion effect rendering from the inventory GUIs"); + public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( + "disableItemSwitchRenderCooldown", false, "", + "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); + public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( + "disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); + public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( + "disableNauseaEffect", false, "", "Disables the nausea visual effects"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", + false, "", "Removes the fog in the Nether"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( + "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); + public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", false, + "", "Disable Observers from triggering at all"); + public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( + "disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); + public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", + false, "", "Disables all particles"); + public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( + "disablePortalGuiClosing", false, "", + "If enabled, then you can still open GUIs while in a Nether Portal"); + public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", + false, "", "Disables rain rendering and sounds"); + public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( + "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); + public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( + "disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); + public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( + "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); + public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( + "disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); + public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( + "disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); + public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, + "", "Prevent the Sign edit GUI from opening"); + public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", + false, "", + "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); + public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( + "disableSlimeBlockSlowdown", false, "", + "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( + "disableStatusEffectHud", false, "", + "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( + "disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( + "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( + "disableVillagerTradeLocking", false, "", + "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); + public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( + "disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( + "disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + DISABLE_ARMOR_STAND_RENDERING, + DISABLE_AXE_STRIPPING, + DISABLE_BAT_SPAWNING, + DISABLE_BEACON_BEAM_RENDERING, + DISABLE_BLOCK_BREAK_PARTICLES, + DISABLE_DOUBLE_TAP_SPRINT, + DISABLE_BOSS_BAR, + DISABLE_BOSS_FOG, + DISABLE_CHUNK_RENDERING, + DISABLE_CLIENT_ENTITY_UPDATES, + DISABLE_CLIENT_LIGHT_UPDATES, + DISABLE_CONSTANT_CHUNK_SAVING, + DISABLE_CREATIVE_INFESTED_BLOCKS, + DISABLE_DEAD_MOB_RENDERING, + DISABLE_DEAD_MOB_TARGETING, + DISABLE_ENTITY_RENDERING, + DISABLE_ENTITY_TICKING, + DISABLE_FALLING_BLOCK_RENDER, + DISABLE_FP_EFFECT_PARTICLES, + DISABLE_INVENTORY_EFFECTS, + DISABLE_ITEM_SWITCH_COOLDOWN, + DISABLE_MOB_SPAWNER_MOB_RENDER, + DISABLE_NAUSEA_EFFECT, + DISABLE_NETHER_FOG, + DISABLE_NETHER_PORTAL_SOUND, + DISABLE_OBSERVER, + DISABLE_OFFHAND_RENDERING, + DISABLE_PARTICLES, + DISABLE_PORTAL_GUI_CLOSING, + DISABLE_RAIN_EFFECTS, + DISABLE_RENDERING_SCAFFOLDING, + DISABLE_RENDER_DISTANCE_FOG, + DISABLE_SCOREBOARD_RENDERING, + DISABLE_SHULKER_BOX_TOOLTIP, + DISABLE_SHOVEL_PATHING, + DISABLE_SIGN_GUI, + DISABLE_SKY_DARKNESS, + DISABLE_SLIME_BLOCK_SLOWDOWN, + DISABLE_STATUS_EFFECT_HUD, + DISABLE_TILE_ENTITY_RENDERING, + DISABLE_TILE_ENTITY_TICKING, + DISABLE_VILLAGER_TRADE_LOCKING, + DISABLE_WALL_UNSPRINT, + DISABLE_WORLD_VIEW_BOB); + } + + public static class Internal { + public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, + "This is just for the mod internally to track the\ncurrently selected fly speed preset"); + public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, + "The original gamma value, before the gamma override was enabled"); + public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger("hotbarScrollCurrentRow", 3, 0, + 3, + "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); + public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( + "slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); + public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, 135, + "The last snapped-to pitch value"); + public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, + "The last snapped-to yaw value"); + + public static final ImmutableList OPTIONS = ImmutableList.of( + FLY_SPEED_PRESET, + GAMMA_VALUE_ORIGINAL, + HOTBAR_SCROLL_CURRENT_ROW, + SLIME_BLOCK_SLIPPERINESS_ORIGINAL, + SNAP_AIM_LAST_YAW); + } + + public static ConfigDouble getActiveFlySpeedConfig() { + switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { + case 0: + return Configs.Generic.FLY_SPEED_PRESET_1; + case 1: + return Configs.Generic.FLY_SPEED_PRESET_2; + case 2: + return Configs.Generic.FLY_SPEED_PRESET_3; + case 3: + return Configs.Generic.FLY_SPEED_PRESET_4; + default: + return Configs.Generic.FLY_SPEED_PRESET_1; } + } - public static class Fixes { - public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, - "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); - public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", - false, - "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); - public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( - "ravagerClientBlockBreakFix", false, - "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - ELYTRA_FIX, - MAC_HORIZONTAL_SCROLL, - RAVAGER_CLIENT_BLOCK_BREAK_FIX); - } + public static void loadFromFile() { + File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); - public static class Lists { - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "blockTypeBreakRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Block Type Break Restriction tweak"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( - "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), - "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( - "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), - "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); - public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", - ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", - "minecraft:repeating_command_block", "minecraft:dragon_egg", - "minecraft:structure_void", - "minecraft:structure_block", - "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), - "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "entityTypeAttackRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Entity Type Attack Restriction tweak"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( - "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), - "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( - "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), - "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", - ImmutableList.of( - " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", - "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", - "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), - "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); - public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( - "fastPlacementItemListType", ListType.BLACKLIST, - "The item restriction type for the Fast Block Placement tweak"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( - "fastPlacementItemBlackList", - ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), - "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( - "fastPlacementItemWhiteList", ImmutableList.of(), - "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( - "fastRightClickBlockListType", ListType.BLACKLIST, - "The targeted block restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( - "fastRightClickBlockBlackList", - ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", - "minecraft:white_shulker_box"), - "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( - "fastRightClickBlockWhiteList", ImmutableList.of(), - "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( - "fastRightClickListType", ListType.NONE, - "The item restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( - "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), - "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( - "fastRightClickWhiteList", - ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", - "minecraft:glass_bottle"), - "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); - public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", - ImmutableList.of( - "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", - "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), - "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); - public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList( - "handRestockListType", - ListType.NONE, "The restriction list type for the Hand Restock tweak"); - public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList( - "handRestockBlackList", - ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), - "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); - public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList( - "handRestockWhiteList", - ImmutableList.of(), - "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); - public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList( - "potionWarningListType", - ListType.NONE, "The list type for potion warning effects"); - public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList( - "potionWarningBlackList", - ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", - "minecraft:poison", - "minecraft:slowness", "minecraft:weakness"), - "The potion effects that will not be warned about"); - public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList( - "potionWarningWhiteList", - ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", - "minecraft:water_breathing"), - "The only potion effects that will be warned about"); - public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", - ImmutableList.of("mainhand", "offhand"), - "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); - public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", - ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), - "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, - BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST, - BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST, - CREATIVE_EXTRA_ITEMS, - ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE, - ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST, - ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST, - ENTITY_WEAPON_MAPPING, - FAST_PLACEMENT_ITEM_LIST_TYPE, - FAST_RIGHT_CLICK_BLOCK_LIST_TYPE, - FAST_RIGHT_CLICK_ITEM_LIST_TYPE, - POTION_WARNING_LIST_TYPE, - FAST_PLACEMENT_ITEM_BLACKLIST, - FAST_PLACEMENT_ITEM_WHITELIST, - FAST_RIGHT_CLICK_BLOCK_BLACKLIST, - FAST_RIGHT_CLICK_BLOCK_WHITELIST, - FAST_RIGHT_CLICK_ITEM_BLACKLIST, - FAST_RIGHT_CLICK_ITEM_WHITELIST, - FLAT_WORLD_PRESETS, - HAND_RESTOCK_LIST_TYPE, - HAND_RESTOCK_BLACKLIST, - HAND_RESTOCK_WHITELIST, - POTION_WARNING_BLACKLIST, - POTION_WARNING_WHITELIST, - REPAIR_MODE_SLOTS, - UNSTACKING_ITEMS); - } + if (configFile.exists() && configFile.isFile() && configFile.canRead()) { + JsonElement element = JsonUtils.parseJsonFile(configFile); - public static class Disable { - public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( - "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); - public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( - "disableAxeStripping", false, "", "Disables stripping logs with an axe"); - public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient( - "disableBatSpawning", - false, "", "Disables Bat spawning in single player"); - public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( - "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( - "disableBlockBreakingParticles", false, "", - "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( - "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", - false, - "", "Disables boss bar rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", - false, - "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( - "disableChunkRendering", false, "", - "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( - "disableClientEntityUpdates", false, "", - "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( - "disableClientLightUpdates", false, "", "Disables all client-side light updates"); - public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( - "disableConstantChunkSaving", false, "", - "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); - public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( - "disableCreativeMenuInfestedBlocks", false, "", - "Removes infested stone blocks from the creative search inventory"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( - "disableDeadMobRendering", false, "", - "Prevents rendering dead mobs (entities that are at 0 health)"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( - "disableDeadMobTargeting", false, "", - "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableEntityRendering", false, "", - "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( - "disableEntityTicking", false, "", - "Prevent everything except player entities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( - "disableFallingBlockEntityRendering", false, "", - "If enabled, then falling block entities won't be rendered at all"); - public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( - "disableFirstPersonEffectParticles", false, "", - "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); - public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( - "disableInventoryEffectRendering", false, "", - "Removes the potion effect rendering from the inventory GUIs"); - public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( - "disableItemSwitchRenderCooldown", false, "", - "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); - public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( - "disableMobSpawnerMobRendering", false, "", - "Removes the entity rendering from mob spawners"); - public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( - "disableNauseaEffect", false, "", "Disables the nausea visual effects"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed( - "disableNetherFog", - false, "", "Removes the fog in the Nether"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( - "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); - public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", - false, - "", "Disable Observers from triggering at all"); - public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( - "disableOffhandRendering", false, "", - "Disables the offhand item from getting rendered"); - public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed( - "disableParticles", - false, "", "Disables all particles"); - public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( - "disablePortalGuiClosing", false, "", - "If enabled, then you can still open GUIs while in a Nether Portal"); - public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed( - "disableRainEffects", - false, "", "Disables rain rendering and sounds"); - public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( - "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); - public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( - "disableRenderDistanceFog", false, "", - "Disables the fog that increases around the render distance"); - public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( - "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); - public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( - "disableShulkerBoxTooltip", false, "", - "Disables the vanilla text tooltip for Shulker Box contents"); - public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( - "disableShovelPathing", false, "", - "Disables converting grass etc. to Path Blocks with a shovel"); - public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", - false, - "", "Prevent the Sign edit GUI from opening"); - public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed( - "disableSkyDarkness", - false, "", - "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); - public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( - "disableSlimeBlockSlowdown", false, "", - "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( - "disableStatusEffectHud", false, "", - "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableTileEntityRendering", false, "", - "Prevents all TileEntity renderers from rendering"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( - "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( - "disableVillagerTradeLocking", false, "", - "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); - public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( - "disableWallUnsprint", false, "", - "Touching a wall doesn't drop you out from sprint mode"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( - "disableWorldViewBob", false, "", - "Disables the view bob wobble effect of the world, but not the hand"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - DISABLE_ARMOR_STAND_RENDERING, - DISABLE_AXE_STRIPPING, - DISABLE_BAT_SPAWNING, - DISABLE_BEACON_BEAM_RENDERING, - DISABLE_BLOCK_BREAK_PARTICLES, - DISABLE_DOUBLE_TAP_SPRINT, - DISABLE_BOSS_BAR, - DISABLE_BOSS_FOG, - DISABLE_CHUNK_RENDERING, - DISABLE_CLIENT_ENTITY_UPDATES, - DISABLE_CLIENT_LIGHT_UPDATES, - DISABLE_CONSTANT_CHUNK_SAVING, - DISABLE_CREATIVE_INFESTED_BLOCKS, - DISABLE_DEAD_MOB_RENDERING, - DISABLE_DEAD_MOB_TARGETING, - DISABLE_ENTITY_RENDERING, - DISABLE_ENTITY_TICKING, - DISABLE_FALLING_BLOCK_RENDER, - DISABLE_FP_EFFECT_PARTICLES, - DISABLE_INVENTORY_EFFECTS, - DISABLE_ITEM_SWITCH_COOLDOWN, - DISABLE_MOB_SPAWNER_MOB_RENDER, - DISABLE_NAUSEA_EFFECT, - DISABLE_NETHER_FOG, - DISABLE_NETHER_PORTAL_SOUND, - DISABLE_OBSERVER, - DISABLE_OFFHAND_RENDERING, - DISABLE_PARTICLES, - DISABLE_PORTAL_GUI_CLOSING, - DISABLE_RAIN_EFFECTS, - DISABLE_RENDERING_SCAFFOLDING, - DISABLE_RENDER_DISTANCE_FOG, - DISABLE_SCOREBOARD_RENDERING, - DISABLE_SHULKER_BOX_TOOLTIP, - DISABLE_SHOVEL_PATHING, - DISABLE_SIGN_GUI, - DISABLE_SKY_DARKNESS, - DISABLE_SLIME_BLOCK_SLOWDOWN, - DISABLE_STATUS_EFFECT_HUD, - DISABLE_TILE_ENTITY_RENDERING, - DISABLE_TILE_ENTITY_TICKING, - DISABLE_VILLAGER_TRADE_LOCKING, - DISABLE_WALL_UNSPRINT, - DISABLE_WORLD_VIEW_BOB); - } + if (element != null && element.isJsonObject()) { + JsonObject root = element.getAsJsonObject(); - public static class Internal { - public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, - "This is just for the mod internally to track the\ncurrently selected fly speed preset"); - public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, - "The original gamma value, before the gamma override was enabled"); - public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger( - "hotbarScrollCurrentRow", 3, 0, - 3, - "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); - public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( - "slimeBlockSlipperinessOriginal", 0.8, 0, 1, - "The original slipperiness value of Slime Blocks"); - public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, - 135, - "The last snapped-to pitch value"); - public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, - "The last snapped-to yaw value"); - - public static final ImmutableList OPTIONS = ImmutableList.of( - FLY_SPEED_PRESET, - GAMMA_VALUE_ORIGINAL, - HOTBAR_SCROLL_CURRENT_ROW, - SLIME_BLOCK_SLIPPERINESS_ORIGINAL, - SNAP_AIM_LAST_YAW); + ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); + ConfigUtils.readConfigBase(root, "Generic", Configs.Generic.OPTIONS); + ConfigUtils.readConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); + ConfigUtils.readConfigBase(root, "Internal", Configs.Internal.OPTIONS); + ConfigUtils.readConfigBase(root, "Lists", Configs.Lists.OPTIONS); + ConfigUtils.readHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); + ConfigUtils.readHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", FeatureToggle.VALUES); + } } - public static ConfigDouble getActiveFlySpeedConfig() { - switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { - case 0: - return Configs.Generic.FLY_SPEED_PRESET_1; - case 1: - return Configs.Generic.FLY_SPEED_PRESET_2; - case 2: - return Configs.Generic.FLY_SPEED_PRESET_3; - case 3: - return Configs.Generic.FLY_SPEED_PRESET_4; - default: - return Configs.Generic.FLY_SPEED_PRESET_1; - } + // TODO 1.19.3+ + // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); + + InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); + InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); + InventoryUtils.setRepairModeSlots(Lists.REPAIR_MODE_SLOTS.getStrings()); + InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); + InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); + + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION + .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( + Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), + Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); + + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( + Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), + Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); + + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( + Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), + Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); + + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION + .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( + Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), + Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); + + PlacementTweaks.HAND_RESTOCK_RESTRICTION + .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( + Lists.HAND_RESTOCK_BLACKLIST.getStrings(), + Lists.HAND_RESTOCK_WHITELIST.getStrings()); + + MiscTweaks.POTION_RESTRICTION.setListType((ListType) Lists.POTION_WARNING_LIST_TYPE.getOptionListValue()); + MiscTweaks.POTION_RESTRICTION.setListContents( + Lists.POTION_WARNING_BLACKLIST.getStrings(), + Lists.POTION_WARNING_WHITELIST.getStrings()); + + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION + .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( + Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), + Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); + + if (MinecraftClient.getInstance().world == null) { + // Turn off after loading the configs, just in case it was enabled in the config + // somehow. + // But only if we are currently not in a world, since changing configs also + // re-loads them when closing the menu. + FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); } + } - public static void loadFromFile() { - File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); - - if (configFile.exists() && configFile.isFile() && configFile.canRead()) { - JsonElement element = JsonUtils.parseJsonFile(configFile); - - if (element != null && element.isJsonObject()) { - JsonObject root = element.getAsJsonObject(); - - ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); - ConfigUtils.readConfigBase(root, "Generic", Configs.Generic.OPTIONS); - ConfigUtils.readConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); - ConfigUtils.readConfigBase(root, "Internal", Configs.Internal.OPTIONS); - ConfigUtils.readConfigBase(root, "Lists", Configs.Lists.OPTIONS); - ConfigUtils.readHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", - Disable.OPTIONS); - ConfigUtils.readHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", - FeatureToggle.VALUES); - } - } - - // TODO 1.19.3+ - // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); - - InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); - InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); - InventoryUtils.setRepairModeSlots(Lists.REPAIR_MODE_SLOTS.getStrings()); - InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); - InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); - - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION - .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE - .getOptionListValue()); - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( - Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), - Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); - - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( - Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), - Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); - - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( - Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), - Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); - - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( - Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), - Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); - - PlacementTweaks.HAND_RESTOCK_RESTRICTION - .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); - PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( - Lists.HAND_RESTOCK_BLACKLIST.getStrings(), - Lists.HAND_RESTOCK_WHITELIST.getStrings()); - - MiscTweaks.POTION_RESTRICTION - .setListType((ListType) Lists.POTION_WARNING_LIST_TYPE.getOptionListValue()); - MiscTweaks.POTION_RESTRICTION.setListContents( - Lists.POTION_WARNING_BLACKLIST.getStrings(), - Lists.POTION_WARNING_WHITELIST.getStrings()); - - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION - .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE - .getOptionListValue()); - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( - Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), - Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); - - MinecraftClient ci = MinecraftClient.getInstance(); // Makes warnings go away - if (ci.world == null) { - // Turn off after loading the configs, just in case it was enabled in the config - // somehow. - // But only if we are currently not in a world, since changing configs also - // re-loads them when closing the menu. - FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); - } - } + public static void saveToFile() { + File dir = FileUtils.getConfigDirectory(); - public static void saveToFile() { - File dir = FileUtils.getConfigDirectory(); + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { + JsonObject root = new JsonObject(); - if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { - JsonObject root = new JsonObject(); + ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); + ConfigUtils.writeConfigBase(root, "Generic", Configs.Generic.OPTIONS); + ConfigUtils.writeConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); + ConfigUtils.writeConfigBase(root, "Internal", Configs.Internal.OPTIONS); + ConfigUtils.writeConfigBase(root, "Lists", Configs.Lists.OPTIONS); + ConfigUtils.writeHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); + ConfigUtils.writeHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", FeatureToggle.VALUES); - ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); - ConfigUtils.writeConfigBase(root, "Generic", Configs.Generic.OPTIONS); - ConfigUtils.writeConfigBase(root, "GenericHotkeys", Hotkeys.HOTKEY_LIST); - ConfigUtils.writeConfigBase(root, "Internal", Configs.Internal.OPTIONS); - ConfigUtils.writeConfigBase(root, "Lists", Configs.Lists.OPTIONS); - ConfigUtils.writeHotkeyToggleOptions(root, "DisableHotkeys", "DisableToggles", Disable.OPTIONS); - ConfigUtils.writeHotkeyToggleOptions(root, "TweakHotkeys", "TweakToggles", - FeatureToggle.VALUES); - - JsonUtils.writeJsonToFile(root, new File(dir, CONFIG_FILE_NAME)); - } + JsonUtils.writeJsonToFile(root, new File(dir, CONFIG_FILE_NAME)); } + } - @Override - public void load() { - loadFromFile(); - } + @Override + public void load() { + loadFromFile(); + } - @Override - public void save() { - saveToFile(); - } + @Override + public void save() { + saveToFile(); + } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 0bdcc7822..6de4ed80a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -3,7 +3,6 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; - import fi.dy.masa.malilib.config.ConfigType; import fi.dy.masa.malilib.config.IConfigBoolean; import fi.dy.masa.malilib.config.IConfigNotifiable; @@ -17,164 +16,89 @@ import fi.dy.masa.malilib.util.StringUtils; import fi.dy.masa.tweakeroo.Tweakeroo; -public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable { - TWEAK_ACCURATE_BLOCK_PLACEMENT("tweakAccurateBlockPlacement", false, "", - "Enables a simpler version of Flexible placement, similar to\nthe Carpet mod, so basically either facing into or out\nfrom the block face clicked on."), - TWEAK_AFTER_CLICKER("tweakAfterClicker", false, "", KeybindSettings.INGAME_BOTH, - "Enables a \"after clicker\" tweak, which does automatic right\nclicks on the just-placed block.\nUseful for example for Repeaters (setting the delay).\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_AIM_LOCK("tweakAimLock", false, "", - "Enables an aim lock, locking the yaw and pitch rotations\nto the current values.\nThis is separate from the snap aim lock,\nwhich locks them to the snapped value.\nThis allows locking them \"freely\" to the current value."), - TWEAK_ANGEL_BLOCK("tweakAngelBlock", false, "", - "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode"), - TWEAK_BLOCK_REACH_OVERRIDE("tweakBlockReachOverride", false, "", - "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"), - TWEAK_ENTITY_REACH_OVERRIDE("tweakEntityReachOverride", false, "", - "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), - TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", - "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), - TWEAK_BREAKING_GRID("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, - "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), - TWEAK_BREAKING_RESTRICTION("tweakBreakingRestriction", false, "", - "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), - TWEAK_CHAT_BACKGROUND_COLOR("tweakChatBackgroundColor", false, "", - "Overrides the default chat background color\nwith the one from Generics -> 'chatBackgroundColor'"), - TWEAK_CHAT_PERSISTENT_TEXT("tweakChatPersistentText", false, "", - "Stores the text from the chat input text field\nand restores it when the chat is opened again"), - TWEAK_CHAT_TIMESTAMP("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), - TWEAK_COMMAND_BLOCK_EXTRA_FIELDS("tweakCommandBlockExtraFields", false, "", - "Adds extra fields to the Command Block GUI, for settings\nthe name of the command block, and seeing the stats results"), +public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable +{ + TWEAK_ACCURATE_BLOCK_PLACEMENT ("tweakAccurateBlockPlacement", false, "", "Enables a simpler version of Flexible placement, similar to\nthe Carpet mod, so basically either facing into or out\nfrom the block face clicked on."), + TWEAK_AFTER_CLICKER ("tweakAfterClicker", false, "", KeybindSettings.INGAME_BOTH, "Enables a \"after clicker\" tweak, which does automatic right\nclicks on the just-placed block.\nUseful for example for Repeaters (setting the delay).\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_AIM_LOCK ("tweakAimLock", false, "", "Enables an aim lock, locking the yaw and pitch rotations\nto the current values.\nThis is separate from the snap aim lock,\nwhich locks them to the snapped value.\nThis allows locking them \"freely\" to the current value."), + TWEAK_ANGEL_BLOCK ("tweakAngelBlock", false, "", "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode"), + TWEAK_BLOCK_REACH_OVERRIDE ("tweakBlockReachOverride", false, "", "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"), + TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), + TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), + TWEAK_BREAKING_RESTRICTION ("tweakBreakingRestriction", false, "", "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), + TWEAK_CHAT_BACKGROUND_COLOR ("tweakChatBackgroundColor", false, "", "Overrides the default chat background color\nwith the one from Generics -> 'chatBackgroundColor'"), + TWEAK_CHAT_PERSISTENT_TEXT ("tweakChatPersistentText", false, "", "Stores the text from the chat input text field\nand restores it when the chat is opened again"), + TWEAK_CHAT_TIMESTAMP ("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), + TWEAK_COMMAND_BLOCK_EXTRA_FIELDS("tweakCommandBlockExtraFields", false, "", "Adds extra fields to the Command Block GUI, for settings\nthe name of the command block, and seeing the stats results"), // TODO 1.19.3+ - // TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds - // custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control - // which items are added to the groups.\nNote: Currently these will be added to - // the Transportation group\n(because it has the elast items), but in the - // future\nthe groups will be configurable per added item"), + //TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), // TODO/FIXME 1.19+ the mixin needs an access widener now - // TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows - // adding custom flat world presets to the list.\nThe presets are defined in - // Lists -> flatWorldPresets"), - TWEAK_CUSTOM_FLY_DECELERATION("tweakCustomFlyDeceleration", false, "", - "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), - TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", - "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), - TWEAK_ELYTRA_CAMERA("tweakElytraCamera", false, "", - "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), - TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction", false, "", - "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), - TWEAK_SHULKERBOX_STACKING("tweakEmptyShulkerBoxesStack", false, true, "", - "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), - TWEAK_SHULKERBOX_STACK_GROUND("tweakEmptyShulkerBoxesStackOnGround", false, true, "", - "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), - TWEAK_EXPLOSION_REDUCED_PARTICLES("tweakExplosionReducedParticles", false, "", - "If enabled, then all explosion particles will use the\nEXPLOSION_NORMAL particle instead of possibly\nthe EXPLOSION_LARGE or EXPLOSION_HUGE particles"), - TWEAK_F3_CURSOR("tweakF3Cursor", false, "", "Enables always rendering the F3 screen cursor"), - TWEAK_FAKE_SNEAKING("tweakFakeSneaking", false, "", - "Enables \"fake sneaking\" ie. prevents you from falling from edges\nwithout slowing down the movement speed"), - TWEAK_FAKE_SNEAK_PLACEMENT("tweakFakeSneakPlacement", false, "", - "This tweak offsets the click position to the adjacent air block\nfrom the block that you actually click on.\nThis basically allows you to place blocks against blocks\nthat have a click action, such as opening inventory GUIs,\nwithout having to sneak. Note that this doesn't not actually\nfake sneaking in any way, just the apparent effect is similar."), - TWEAK_FAST_BLOCK_PLACEMENT("tweakFastBlockPlacement", false, "", - "Enables fast/convenient block placement when moving\nthe cursor over new blocks"), - TWEAK_FAST_LEFT_CLICK("tweakFastLeftClick", false, "", - "Enables automatic fast left clicking while holding down\nthe attack button (left click).\nThe number of clicks per tick is set in the Generic configs."), - TWEAK_FAST_RIGHT_CLICK("tweakFastRightClick", false, "", - "Enables automatic fast right clicking while holding down\nthe use button (right click).\nThe number of clicks per tick is set in the Generic configs."), - TWEAK_FILL_CLONE_LIMIT("tweakFillCloneLimit", false, true, "", - "Enables overriding the /fill and /clone command\nblock limits in single player.\nThe new limit can be set in the Generic configs,\nin the 'fillCloneLimit' config value"), - TWEAK_FLY_SPEED("tweakFlySpeed", false, "", KeybindSettings.INGAME_BOTH, - "Enables overriding the fly speed in creative or spectator mode\nand using some presets for it"), - TWEAK_FLEXIBLE_BLOCK_PLACEMENT("tweakFlexibleBlockPlacement", false, "", - "Enables placing blocks in different orientations\nor with an offset, while holding down the\nhotkeys for those modes."), - TWEAK_FREE_CAMERA("tweakFreeCamera", false, "", - "Enables a free camera mode, similar to spectator mode,\nbut where the player will remain in place where\nyou first activate the free camera mode"), - TWEAK_GAMMA_OVERRIDE("tweakGammaOverride", false, "", - "Overrides the video settings gamma value with\nthe one set in the Generic configs"), - TWEAK_HAND_RESTOCK("tweakHandRestock", false, "", - "Enables swapping a new stack to the main or the offhand\nwhen the previous stack runs out"), - TWEAK_HANGABLE_ENTITY_BYPASS("tweakHangableEntityBypass", false, "", - "Allows not targeting hangable entities (Item Frames and Paintings).\nThe Generic -> hangableEntityBypassInverse option can be used to control\nwhether you must be sneaking or not sneaking to be able to target the entity."), - TWEAK_HOLD_ATTACK("tweakHoldAttack", false, "", "Emulates holding down the attack button"), - TWEAK_HOLD_USE("tweakHoldUse", false, "", "Emulates holding down the use button"), - TWEAK_HOTBAR_SCROLL("tweakHotbarScroll", false, "", "Enables the hotbar swapping via scrolling feature"), - TWEAK_HOTBAR_SLOT_CYCLE("tweakHotbarSlotCycle", false, "", KeybindSettings.INGAME_BOTH, - "Enables cycling the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_HOTBAR_SLOT_RANDOMIZER("tweakHotbarSlotRandomizer", false, "", KeybindSettings.INGAME_BOTH, - "Enables randomizing the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_HOTBAR_SWAP("tweakHotbarSwap", false, "", "Enables the hotbar swapping via hotkeys feature"), - TWEAK_INVENTORY_PREVIEW("tweakInventoryPreview", false, true, "", - "Enables an inventory preview while having the cursor over\na block or an entity with an inventory and holding down\nthe configured hotkey."), - TWEAK_ITEM_UNSTACKING_PROTECTION("tweakItemUnstackingProtection", false, "", - "If enabled, then items configured in Lists -> unstackingItems\nwon't be allowed to spill out when using.\nThis is meant for example to prevent throwing buckets\ninto lava when filling them."), - TWEAK_LAVA_VISIBILITY("tweakLavaVisibility", false, "", - "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."), - TWEAK_MAP_PREVIEW("tweakMapPreview", false, "", - "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"), - TWEAK_MOVEMENT_KEYS("tweakMovementKeysLast", false, "", - "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."), - TWEAK_PERIODIC_ATTACK("tweakPeriodicAttack", false, "", - "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"), - TWEAK_PERIODIC_USE("tweakPeriodicUse", false, "", - "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"), - TWEAK_PERIODIC_HOLD_ATTACK("tweakPeriodicHoldAttack", false, "", - "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"), - TWEAK_PERIODIC_HOLD_USE("tweakPeriodicHoldUse", false, "", - "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), - TWEAK_PERMANENT_SNEAK("tweakPermanentSneak", false, "", "If enabled, the player will be sneaking the entire time"), - TWEAK_PERMANENT_SPRINT("tweakPermanentSprint", false, "", - "If enabled, the player will be always sprinting when moving forward"), - TWEAK_PLACEMENT_GRID("tweakPlacementGrid", false, "", KeybindSettings.INGAME_BOTH, - "When enabled, you can only place blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_PLACEMENT_LIMIT("tweakPlacementLimit", false, "", KeybindSettings.INGAME_BOTH, - "When enabled, you can only place a set number\nof blocks per use/right click.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), - TWEAK_PLACEMENT_RESTRICTION("tweakPlacementRestriction", false, "", - "Enables the Placement Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal)"), - TWEAK_PLACEMENT_REST_FIRST("tweakPlacementRestrictionFirst", false, "", - "Restricts block placement so that you can only\nplace blocks against the same block type\nyou first clicked on"), - TWEAK_PLACEMENT_REST_HAND("tweakPlacementRestrictionHand", false, "", - "Restricts block placement so that you can only\nplace blocks against the same block type\nyou are holding in your hand"), - TWEAK_PLAYER_INVENTORY_PEEK("tweakPlayerInventoryPeek", false, "", - "Enables a player inventory peek/preview, while holding the\nconfigured hotkey key for it."), - TWEAK_POTION_WARNING("tweakPotionWarning", false, "", - "Prints a warning message to the hotbar when\nnon-ambient potion effects are about to run out"), - TWEAK_PRINT_DEATH_COORDINATES("tweakPrintDeathCoordinates", false, "", - "Enables printing the player's coordinates to chat on death.\nThis feature is originally from usefulmod by nessie."), - TWEAK_PICK_BEFORE_PLACE("tweakPickBeforePlace", false, "", - "If enabled, then before each block placement, the same block\nis switched to hand that you are placing against"), - TWEAK_PLAYER_LIST_ALWAYS_ON("tweakPlayerListAlwaysVisible", false, "", - "If enabled, then the player list is always rendered without\nhaving to hold down the key (tab by default)"), - TWEAK_RENDER_EDGE_CHUNKS("tweakRenderEdgeChunks", false, "", - "Allows the edge-most client-loaded chunks to render.\nVanilla doesn't allow rendering chunks that don't have\nall the adjacent chunks loaded, meaning that the edge-most chunk\nof the client's loaded won't render in vanilla.\n§lThis is also very helpful in the Free Camera mode!§r"), - TWEAK_RENDER_INVISIBLE_ENTITIES("tweakRenderInvisibleEntities", false, "", - "When enabled, invisible entities are rendered like\nthey would be in spectator mode."), - TWEAK_RENDER_LIMIT_ENTITIES("tweakRenderLimitEntities", false, "", - "Enables limiting the number of certain types of entities\nto render per frame. Currently XP Orbs and Item entities\nare supported, see Generic configs for the limits."), - TWEAK_REPAIR_MODE("tweakRepairMode", false, "", - "If enabled, then fully repaired items held in hand will\nbe swapped to damaged items that have Mending on them."), - TWEAK_SCULK_PULSE_LENGTH("tweakSculkPulseLength", false, true, "", - "Allows modifying the Sculk Sensor pulse length. Set the pulse length in Generic -> sculkSensorPulseLength"), - TWEAK_SHULKERBOX_DISPLAY("tweakShulkerBoxDisplay", false, "", - "Enables the Shulker Box contents display when hovering\nover them in an inventory and holding shift"), - TWEAK_SIGN_COPY("tweakSignCopy", false, "", - "When enabled, placed signs will use the text from\nthe previously placed sign.\nCan be combined with tweakNoSignGui to quickly place copies\nof a sign, by enabling that tweak after making the first sign."), - TWEAK_SNAP_AIM("tweakSnapAim", false, "", KeybindSettings.INGAME_BOTH, - "Enabled a snap aim tweak, to make the player face to pre-set exact yaw rotations"), - TWEAK_SNAP_AIM_LOCK("tweakSnapAimLock", false, "", - "Enables a snap aim lock, locking the yaw and/or pitch rotations\nto the currently snapped value"), - TWEAK_SNEAK_1_15_2("tweakSneak_1.15.2", false, "", "Restores the 1.15.2 sneaking behavior"), - TWEAK_SPECTATOR_TELEPORT("tweakSpectatorTeleport", false, "", - "Allows spectators to teleport to other spectators.\nThis is originally from usefulmod by nessie."), - TWEAK_STRUCTURE_BLOCK_LIMIT("tweakStructureBlockLimit", false, true, "", - "Allows overriding the structure block limit.\nThe new limit is set in Generic -> structureBlockMaxSize"), - TWEAK_SWAP_ALMOST_BROKEN_TOOLS("tweakSwapAlmostBrokenTools", false, "", - "If enabled, then any damageable items held in the hand that\nare about to break will be swapped to fresh ones"), - TWEAK_TAB_COMPLETE_COORDINATE("tweakTabCompleteCoordinate", false, "", - "If enabled, then tab-completing coordinates while not\nlooking at a block, will use the player's position\ninstead of adding the ~ character."), - TWEAK_TOOL_SWITCH("tweakToolSwitch", false, "", - "Enables automatically switching to an effective tool for the targeted block"), - TWEAK_WEAPON_SWITCH("tweakWeaponSwitch", false, "", - "Enables automatically switching to a weapon for the targeted entity"), - TWEAK_Y_MIRROR("tweakYMirror", false, "", - "Mirrors the targeted y-position within the block bounds.\nThis is basically for placing slabs or stairs\nin the opposite top/bottom state from normal,\nif you have to place them against another slab for example."), - TWEAK_ZOOM("tweakZoom", false, "", KeybindSettings.INGAME_BOTH, "Enables using the zoom hotkey to, well, zoom in"); + //TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows adding custom flat world presets to the list.\nThe presets are defined in Lists -> flatWorldPresets"), + TWEAK_CUSTOM_FLY_DECELERATION ("tweakCustomFlyDeceleration", false, "", "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), + TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), + TWEAK_ELYTRA_CAMERA ("tweakElytraCamera", false, "", "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), + TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction",false, "", "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), + TWEAK_SHULKERBOX_STACKING ("tweakEmptyShulkerBoxesStack", false, true, "", "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), + TWEAK_SHULKERBOX_STACK_GROUND ("tweakEmptyShulkerBoxesStackOnGround", false, true, "", "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), + TWEAK_EXPLOSION_REDUCED_PARTICLES ("tweakExplosionReducedParticles", false, "", "If enabled, then all explosion particles will use the\nEXPLOSION_NORMAL particle instead of possibly\nthe EXPLOSION_LARGE or EXPLOSION_HUGE particles"), + TWEAK_F3_CURSOR ("tweakF3Cursor", false, "", "Enables always rendering the F3 screen cursor"), + TWEAK_FAKE_SNEAKING ("tweakFakeSneaking", false, "", "Enables \"fake sneaking\" ie. prevents you from falling from edges\nwithout slowing down the movement speed"), + TWEAK_FAKE_SNEAK_PLACEMENT ("tweakFakeSneakPlacement", false, "", "This tweak offsets the click position to the adjacent air block\nfrom the block that you actually click on.\nThis basically allows you to place blocks against blocks\nthat have a click action, such as opening inventory GUIs,\nwithout having to sneak. Note that this doesn't not actually\nfake sneaking in any way, just the apparent effect is similar."), + TWEAK_FAST_BLOCK_PLACEMENT ("tweakFastBlockPlacement", false, "", "Enables fast/convenient block placement when moving\nthe cursor over new blocks"), + TWEAK_FAST_LEFT_CLICK ("tweakFastLeftClick", false, "", "Enables automatic fast left clicking while holding down\nthe attack button (left click).\nThe number of clicks per tick is set in the Generic configs."), + TWEAK_FAST_RIGHT_CLICK ("tweakFastRightClick", false, "", "Enables automatic fast right clicking while holding down\nthe use button (right click).\nThe number of clicks per tick is set in the Generic configs."), + TWEAK_FILL_CLONE_LIMIT ("tweakFillCloneLimit", false, true, "", "Enables overriding the /fill and /clone command\nblock limits in single player.\nThe new limit can be set in the Generic configs,\nin the 'fillCloneLimit' config value"), + TWEAK_FLY_SPEED ("tweakFlySpeed", false, "", KeybindSettings.INGAME_BOTH, "Enables overriding the fly speed in creative or spectator mode\nand using some presets for it"), + TWEAK_FLEXIBLE_BLOCK_PLACEMENT ("tweakFlexibleBlockPlacement", false, "", "Enables placing blocks in different orientations\nor with an offset, while holding down the\nhotkeys for those modes."), + TWEAK_FREE_CAMERA ("tweakFreeCamera", false, "", "Enables a free camera mode, similar to spectator mode,\nbut where the player will remain in place where\nyou first activate the free camera mode"), + TWEAK_GAMMA_OVERRIDE ("tweakGammaOverride", false, "", "Overrides the video settings gamma value with\nthe one set in the Generic configs"), + TWEAK_HAND_RESTOCK ("tweakHandRestock", false, "", "Enables swapping a new stack to the main or the offhand\nwhen the previous stack runs out"), + TWEAK_HANGABLE_ENTITY_BYPASS ("tweakHangableEntityBypass", false, "", "Allows not targeting hangable entities (Item Frames and Paintings).\nThe Generic -> hangableEntityBypassInverse option can be used to control\nwhether you must be sneaking or not sneaking to be able to target the entity."), + TWEAK_HOLD_ATTACK ("tweakHoldAttack", false, "", "Emulates holding down the attack button"), + TWEAK_HOLD_USE ("tweakHoldUse", false, "", "Emulates holding down the use button"), + TWEAK_HOTBAR_SCROLL ("tweakHotbarScroll", false, "", "Enables the hotbar swapping via scrolling feature"), + TWEAK_HOTBAR_SLOT_CYCLE ("tweakHotbarSlotCycle", false, "", KeybindSettings.INGAME_BOTH, "Enables cycling the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_HOTBAR_SLOT_RANDOMIZER ("tweakHotbarSlotRandomizer", false, "", KeybindSettings.INGAME_BOTH, "Enables randomizing the selected hotbar slot after each placed\nblock, up to the set max slot number.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_HOTBAR_SWAP ("tweakHotbarSwap", false, "", "Enables the hotbar swapping via hotkeys feature"), + TWEAK_INVENTORY_PREVIEW ("tweakInventoryPreview", false, true, "", "Enables an inventory preview while having the cursor over\na block or an entity with an inventory and holding down\nthe configured hotkey."), + TWEAK_ITEM_UNSTACKING_PROTECTION("tweakItemUnstackingProtection", false, "", "If enabled, then items configured in Lists -> unstackingItems\nwon't be allowed to spill out when using.\nThis is meant for example to prevent throwing buckets\ninto lava when filling them."), + TWEAK_LAVA_VISIBILITY ("tweakLavaVisibility", false, "", "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."), + TWEAK_MAP_PREVIEW ("tweakMapPreview", false, "", "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"), + TWEAK_MOVEMENT_KEYS ("tweakMovementKeysLast", false, "", "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."), + TWEAK_PERIODIC_ATTACK ("tweakPeriodicAttack", false, "", "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"), + TWEAK_PERIODIC_USE ("tweakPeriodicUse", false, "", "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"), + TWEAK_PERIODIC_HOLD_ATTACK ("tweakPeriodicHoldAttack", false, "", "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"), + TWEAK_PERIODIC_HOLD_USE ("tweakPeriodicHoldUse", false, "", "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), + TWEAK_PERMANENT_SNEAK ("tweakPermanentSneak", false, "", "If enabled, the player will be sneaking the entire time"), + TWEAK_PERMANENT_SPRINT ("tweakPermanentSprint", false, "", "If enabled, the player will be always sprinting when moving forward"), + TWEAK_PLACEMENT_GRID ("tweakPlacementGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only place blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_PLACEMENT_LIMIT ("tweakPlacementLimit", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only place a set number\nof blocks per use/right click.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), + TWEAK_PLACEMENT_RESTRICTION ("tweakPlacementRestriction", false, "", "Enables the Placement Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal)"), + TWEAK_PLACEMENT_REST_FIRST ("tweakPlacementRestrictionFirst", false, "", "Restricts block placement so that you can only\nplace blocks against the same block type\nyou first clicked on"), + TWEAK_PLACEMENT_REST_HAND ("tweakPlacementRestrictionHand", false, "", "Restricts block placement so that you can only\nplace blocks against the same block type\nyou are holding in your hand"), + TWEAK_PLAYER_INVENTORY_PEEK ("tweakPlayerInventoryPeek", false, "", "Enables a player inventory peek/preview, while holding the\nconfigured hotkey key for it."), + TWEAK_POTION_WARNING ("tweakPotionWarning", false, "", "Prints a warning message to the hotbar when\nnon-ambient potion effects are about to run out"), + TWEAK_PRINT_DEATH_COORDINATES ("tweakPrintDeathCoordinates", false, "", "Enables printing the player's coordinates to chat on death.\nThis feature is originally from usefulmod by nessie."), + TWEAK_PICK_BEFORE_PLACE ("tweakPickBeforePlace", false, "", "If enabled, then before each block placement, the same block\nis switched to hand that you are placing against"), + TWEAK_PLAYER_LIST_ALWAYS_ON ("tweakPlayerListAlwaysVisible", false, "", "If enabled, then the player list is always rendered without\nhaving to hold down the key (tab by default)"), + TWEAK_RENDER_EDGE_CHUNKS ("tweakRenderEdgeChunks", false, "", "Allows the edge-most client-loaded chunks to render.\nVanilla doesn't allow rendering chunks that don't have\nall the adjacent chunks loaded, meaning that the edge-most chunk\nof the client's loaded won't render in vanilla.\n§lThis is also very helpful in the Free Camera mode!§r"), + TWEAK_RENDER_INVISIBLE_ENTITIES ("tweakRenderInvisibleEntities", false, "", "When enabled, invisible entities are rendered like\nthey would be in spectator mode."), + TWEAK_RENDER_LIMIT_ENTITIES ("tweakRenderLimitEntities", false, "", "Enables limiting the number of certain types of entities\nto render per frame. Currently XP Orbs and Item entities\nare supported, see Generic configs for the limits."), + TWEAK_REPAIR_MODE ("tweakRepairMode", false, "", "If enabled, then fully repaired items held in hand will\nbe swapped to damaged items that have Mending on them."), + TWEAK_SCULK_PULSE_LENGTH ("tweakSculkPulseLength", false, true, "", "Allows modifying the Sculk Sensor pulse length. Set the pulse length in Generic -> sculkSensorPulseLength"), + TWEAK_SHULKERBOX_DISPLAY ("tweakShulkerBoxDisplay", false, "", "Enables the Shulker Box contents display when hovering\nover them in an inventory and holding shift"), + TWEAK_SIGN_COPY ("tweakSignCopy", false, "", "When enabled, placed signs will use the text from\nthe previously placed sign.\nCan be combined with tweakNoSignGui to quickly place copies\nof a sign, by enabling that tweak after making the first sign."), + TWEAK_SNAP_AIM ("tweakSnapAim", false, "", KeybindSettings.INGAME_BOTH, "Enabled a snap aim tweak, to make the player face to pre-set exact yaw rotations"), + TWEAK_SNAP_AIM_LOCK ("tweakSnapAimLock", false, "", "Enables a snap aim lock, locking the yaw and/or pitch rotations\nto the currently snapped value"), + TWEAK_SNEAK_1_15_2 ("tweakSneak_1.15.2", false, "", "Restores the 1.15.2 sneaking behavior"), + TWEAK_SPECTATOR_TELEPORT ("tweakSpectatorTeleport", false, "", "Allows spectators to teleport to other spectators.\nThis is originally from usefulmod by nessie."), + TWEAK_STRUCTURE_BLOCK_LIMIT ("tweakStructureBlockLimit", false, true, "", "Allows overriding the structure block limit.\nThe new limit is set in Generic -> structureBlockMaxSize"), + TWEAK_SWAP_ALMOST_BROKEN_TOOLS ("tweakSwapAlmostBrokenTools", false, "", "If enabled, then any damageable items held in the hand that\nare about to break will be swapped to fresh ones"), + TWEAK_TAB_COMPLETE_COORDINATE ("tweakTabCompleteCoordinate", false, "", "If enabled, then tab-completing coordinates while not\nlooking at a block, will use the player's position\ninstead of adding the ~ character."), + TWEAK_TOOL_SWITCH ("tweakToolSwitch", false, "", "Enables automatically switching to an effective tool for the targeted block"), + TWEAK_WEAPON_SWITCH ("tweakWeaponSwitch", false, "", "Enables automatically switching to a weapon for the targeted entity"), + TWEAK_Y_MIRROR ("tweakYMirror", false, "", "Mirrors the targeted y-position within the block bounds.\nThis is basically for placing slabs or stairs\nin the opposite top/bottom state from normal,\nif you have to place them against another slab for example."), + TWEAK_ZOOM ("tweakZoom", false, "", KeybindSettings.INGAME_BOTH, "Enables using the zoom hotkey to, well, zoom in"); public static final ImmutableList VALUES = ImmutableList.copyOf(values()); @@ -187,35 +111,38 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable callback; - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment) { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment) + { this(name, defaultValue, false, defaultHotkey, KeybindSettings.DEFAULT, comment); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment) { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment) + { this(name, defaultValue, singlePlayer, defaultHotkey, KeybindSettings.DEFAULT, comment); } - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, KeybindSettings settings, String comment) { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, KeybindSettings settings, String comment) + { this(name, defaultValue, false, defaultHotkey, settings, comment); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, - KeybindSettings settings, String comment) { - this(name, defaultValue, singlePlayer, defaultHotkey, settings, comment, - StringUtils.splitCamelCase(name.substring(5))); + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, KeybindSettings settings, String comment) + { + this(name, defaultValue, singlePlayer, defaultHotkey, settings, comment, StringUtils.splitCamelCase(name.substring(5))); } - FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName) { + FeatureToggle(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName) + { this(name, defaultValue, false, defaultHotkey, comment, prettyName); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment, - String prettyName) { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, String comment, String prettyName) + { this(name, defaultValue, singlePlayer, defaultHotkey, KeybindSettings.DEFAULT, comment, prettyName); } - FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, - KeybindSettings settings, String comment, String prettyName) { + FeatureToggle(String name, boolean defaultValue, boolean singlePlayer, String defaultHotkey, KeybindSettings settings, String comment, String prettyName) + { this.name = name; this.valueBoolean = defaultValue; this.defaultValueBoolean = defaultValue; @@ -227,21 +154,24 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable callback) { + public void setValueChangeCallback(IValueChangeCallback callback) + { this.callback = callback; } @Override - public String getComment() { - String comment = StringUtils.getTranslatedOrFallback("config.comment." + this.getName().toLowerCase(), - this.comment); + public String getComment() + { + String comment = StringUtils.getTranslatedOrFallback("config.comment." + this.getName().toLowerCase(), this.comment); - if (comment != null && this.singlePlayer) { + if (comment != null && this.singlePlayer) + { return comment + "\n" + StringUtils.translate("tweakeroo.label.config_comment.single_player_only"); } @@ -292,62 +230,76 @@ public String getComment() { } @Override - public IKeybind getKeybind() { + public IKeybind getKeybind() + { return this.keybind; } @Override - public boolean getBooleanValue() { + public boolean getBooleanValue() + { return this.valueBoolean; } @Override - public boolean getDefaultBooleanValue() { + public boolean getDefaultBooleanValue() + { return this.defaultValueBoolean; } @Override - public void setBooleanValue(boolean value) { + public void setBooleanValue(boolean value) + { boolean oldValue = this.valueBoolean; this.valueBoolean = value; - if (oldValue != this.valueBoolean) { + if (oldValue != this.valueBoolean) + { this.onValueChanged(); } } @Override - public boolean isModified() { + public boolean isModified() + { return this.valueBoolean != this.defaultValueBoolean; } @Override - public boolean isModified(String newValue) { + public boolean isModified(String newValue) + { return Boolean.parseBoolean(newValue) != this.defaultValueBoolean; } @Override - public void resetToDefault() { + public void resetToDefault() + { this.valueBoolean = this.defaultValueBoolean; } @Override - public JsonElement getAsJsonElement() { + public JsonElement getAsJsonElement() + { return new JsonPrimitive(this.valueBoolean); } @Override - public void setValueFromJsonElement(JsonElement element) { - try { - if (element.isJsonPrimitive()) { + public void setValueFromJsonElement(JsonElement element) + { + try + { + if (element.isJsonPrimitive()) + { this.valueBoolean = element.getAsBoolean(); - } else { - Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), - element); } - } catch (Exception e) { - Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), - element, e); + else + { + Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), element); + } + } + catch (Exception e) + { + Tweakeroo.logger.warn("Failed to set config value for '{}' from the JSON element '{}'", this.getName(), element, e); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index d54d76600..4b970e296 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -10,11 +10,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.tweaks.MiscTweaks; -import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; -import fi.dy.masa.tweakeroo.util.CameraUtils; -import fi.dy.masa.tweakeroo.util.InventoryUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.entity.Entity; @@ -26,79 +21,110 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.tweaks.MiscTweaks; +import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; +import fi.dy.masa.tweakeroo.util.CameraUtils; +import fi.dy.masa.tweakeroo.util.InventoryUtils; + @Mixin(ClientPlayerInteractionManager.class) -public abstract class MixinClientPlayerInteractionManager { - @Shadow - @Final - private MinecraftClient client; +public abstract class MixinClientPlayerInteractionManager +{ + @Shadow @Final private MinecraftClient client; - @Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), cancellable = true) - private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { + @Inject(method = "interactItem", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), + cancellable = true) + private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) + { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) { + PlacementTweaks.onProcessRightClickPre(player, hand)) + { cir.setReturnValue(ActionResult.PASS); cir.cancel(); } } - @Inject(method = "method_41929", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;use(" - + - "Lnet/minecraft/world/World;" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/TypedActionResult;")), at = @At("RETURN")) + @Inject(method = "method_41929", + slice = @Slice(from = @At(value = "INVOKE", + target = "Lnet/minecraft/item/ItemStack;use(" + + "Lnet/minecraft/world/World;" + + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/TypedActionResult;")), + at = @At("RETURN")) private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, - MutableObject mutableObject, int sequence, - CallbackInfoReturnable> cir) { + MutableObject mutableObject, int sequence, + CallbackInfoReturnable> cir) + { PlacementTweaks.onProcessRightClickPost(playerEntity, hand); } @Inject(method = "interactEntity(" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/entity/Entity;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, - CallbackInfoReturnable cir) { + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/entity/Entity;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/ActionResult;", + at = @At("HEAD"), + cancellable = true) + private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) + { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) { + PlacementTweaks.onProcessRightClickPre(player, hand)) + { cir.setReturnValue(ActionResult.PASS); } } @Inject(method = "interactEntityAtLocation(" + - "Lnet/minecraft/entity/player/PlayerEntity;" + - "Lnet/minecraft/entity/Entity;" + - "Lnet/minecraft/util/hit/EntityHitResult;" + - "Lnet/minecraft/util/Hand;" + - ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, - CallbackInfoReturnable cir) { + "Lnet/minecraft/entity/player/PlayerEntity;" + + "Lnet/minecraft/entity/Entity;" + + "Lnet/minecraft/util/hit/EntityHitResult;" + + "Lnet/minecraft/util/Hand;" + + ")Lnet/minecraft/util/ActionResult;", + at = @At("HEAD"), + cancellable = true) + private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) + { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.onProcessRightClickPre(player, hand)) { + PlacementTweaks.onProcessRightClickPre(player, hand)) + { cir.setReturnValue(ActionResult.PASS); } } @Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true) - private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) { - if (CameraUtils.shouldPreventPlayerInputs()) { + private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) + { + if (CameraUtils.shouldPreventPlayerInputs()) + { ci.cancel(); - } else if (FeatureToggle.TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION.getBooleanValue() && - MiscTweaks.isEntityAllowedByAttackingRestriction(target.getType()) == false) { + } + else if (FeatureToggle.TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION.getBooleanValue() && + MiscTweaks.isEntityAllowedByAttackingRestriction(target.getType()) == false) + { ci.cancel(); - } else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) { + } + else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) + { InventoryUtils.trySwitchToWeapon(target); } } - @Inject(method = "attackBlock", slice = @Slice(from = @At(value = "FIELD", ordinal = 0, target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakingBlock:Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" - + - "Lnet/minecraft/util/math/BlockPos;" + - ")Lnet/minecraft/block/BlockState;", ordinal = 0)) - private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) { - if (this.client.player != null && this.client.world != null) { - if (FeatureToggle.TWEAK_TOOL_SWITCH.getBooleanValue()) { + @Inject(method = "attackBlock", + slice = @Slice(from = @At(value = "FIELD", ordinal = 0, + target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakingBlock:Z")), + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" + + "Lnet/minecraft/util/math/BlockPos;" + + ")Lnet/minecraft/block/BlockState;", ordinal = 0)) + private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) + { + if (this.client.player != null && this.client.world != null) + { + if (FeatureToggle.TWEAK_TOOL_SWITCH.getBooleanValue()) + { InventoryUtils.trySwitchToEffectiveTool(pos); } @@ -107,49 +133,56 @@ private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnabl } @Inject(method = "attackBlock", at = @At("HEAD"), cancellable = true) - private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) { + private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) + { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) { + PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) + { cir.setReturnValue(false); - } else { + } + else + { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); } } @Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true) // MCP: onPlayerDamageBlock - private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) { + private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) + { if (CameraUtils.shouldPreventPlayerInputs() || - PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) { + PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) + { cir.setReturnValue(true); - } else { + } + else + { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); } } - // Value moved to PlayerEntity class as getInteractionRange() - /* - * @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) - * private void overrideReachDistance(CallbackInfoReturnable cir) - * { - * if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - * { - * cir.setReturnValue((float) - * Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); - * } - * } - * - * @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) - * private void overrideExtendedReach(CallbackInfoReturnable cir) - * { - * if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - * { - * cir.setReturnValue(false); - * } - * } - */ + @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) + private void overrideReachDistance(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) + { + cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + } + } + + @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) + private void overrideExtendedReach(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) + { + cir.setReturnValue(false); + } + } + @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) - private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { - if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { + private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) + { cir.setReturnValue(false); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index 1971a0621..d272f3a88 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.scoreboard.ScoreboardDisplaySlot; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -8,65 +9,76 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.renderer.RenderUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.PlayerListHud; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.scoreboard.ScoreboardDisplaySlot; import net.minecraft.scoreboard.ScoreboardObjective; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.renderer.RenderUtils; + @Mixin(InGameHud.class) -public abstract class MixinInGameHud { - @Shadow - @Final - private PlayerListHud playerListHud; - @Shadow - @Final - private MinecraftClient client; - // @Shadow private int scaledWidth; +public abstract class MixinInGameHud +{ + @Shadow @Final private PlayerListHud playerListHud; + @Shadow @Final private MinecraftClient client; + @Shadow private int scaledWidth; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) - private void overridePlayerForRendering(CallbackInfoReturnable cir) { + private void overridePlayerForRendering(CallbackInfoReturnable cir) + { // Fix the hotbar rendering in the Free Camera mode by using the actual player - if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) { + if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) + { cir.setReturnValue(this.client.player); } } - @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) - private void overrideCursorRender(CallbackInfo ci) { - if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { + @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) + private void overrideCursorRender(CallbackInfo ci) + { + if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) + { RenderUtils.renderDirectionsCursor(0, this.client.getTickDelta()); ci.cancel(); } } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", ordinal = 1, shift = At.Shift.AFTER)) - private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) { - if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { + @Inject(method = "render", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", + ordinal = 1, shift = At.Shift.AFTER)) + private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) + { + if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) + { Scoreboard scoreboard = this.client.world.getScoreboard(); ScoreboardObjective objective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.LIST); this.playerListHud.setVisible(true); - this.playerListHud.render(drawContext, drawContext.getScaledWindowWidth(), scoreboard, objective); + this.playerListHud.render(drawContext, this.scaledWidth, scoreboard, objective); } } @Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true) - private void disableScoreboardRendering(CallbackInfo ci) { - if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) { + private void disableScoreboardRendering(CallbackInfo ci) + { + if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) + { ci.cancel(); } } @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) - private void disableStatusEffectHudRendering(CallbackInfo ci) { - if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) { + private void disableStatusEffectHudRendering(CallbackInfo ci) + { + if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) + { ci.cancel(); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 0c0a929a1..2ed9955c2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -41,16 +41,16 @@ private boolean fakeSneaking(PlayerEntity entity) { } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideBlockReachDistance(CallbackInfoReturnable cir) { + private void overrideBlockReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideEntityReachDistance(CallbackInfoReturnable cir) { + private void overrideEntityReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue((float) Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index 54d5907b4..f71c109e6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -5,9 +5,18 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; - import javax.annotation.Nullable; - +import net.minecraft.block.Block; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.registry.Registries; +import net.minecraft.util.Identifier; +import net.minecraft.world.gen.chunk.FlatChunkGeneratorLayer; import fi.dy.masa.malilib.config.IConfigBoolean; import fi.dy.masa.malilib.config.IConfigInteger; import fi.dy.masa.malilib.gui.Message; @@ -22,100 +31,103 @@ import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; import fi.dy.masa.tweakeroo.util.InventoryUtils; import fi.dy.masa.tweakeroo.util.PotionRestriction; -import net.minecraft.block.Block; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.chunk.FlatChunkGeneratorLayer; -public class MiscTweaks { +public class MiscTweaks +{ public static final EntityRestriction ENTITY_TYPE_ATTACK_RESTRICTION = new EntityRestriction(); public static final PotionRestriction POTION_RESTRICTION = new PotionRestriction(); - private static final KeybindState KEY_STATE_ATTACK = new KeybindState( - MinecraftClient.getInstance().options.attackKey, - (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack()); - private static final KeybindState KEY_STATE_USE = new KeybindState(MinecraftClient.getInstance().options.useKey, - (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse()); + private static final KeybindState KEY_STATE_ATTACK = new KeybindState(MinecraftClient.getInstance().options.attackKey, (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack()); + private static final KeybindState KEY_STATE_USE = new KeybindState(MinecraftClient.getInstance().options.useKey, (mc) -> ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse()); private static int potionWarningTimer; - private static class KeybindState { + private static class KeybindState + { private final KeyBinding keybind; private final Consumer clickFunc; private boolean state; private int durationCounter; private int intervalCounter; - public KeybindState(KeyBinding keybind, Consumer clickFunc) { + public KeybindState(KeyBinding keybind, Consumer clickFunc) + { this.keybind = keybind; this.clickFunc = clickFunc; } - public void reset() { + public void reset() + { this.state = false; this.intervalCounter = 0; this.durationCounter = 0; } - public void handlePeriodicHold(int interval, int holdDuration, MinecraftClient mc) { - if (this.state) { - if (++this.durationCounter >= holdDuration) { + public void handlePeriodicHold(int interval, int holdDuration, MinecraftClient mc) + { + if (this.state) + { + if (++this.durationCounter >= holdDuration) + { this.setKeyState(false, mc); this.durationCounter = 0; } - } else if (++this.intervalCounter >= interval) { + } + else if (++this.intervalCounter >= interval) + { this.setKeyState(true, mc); this.intervalCounter = 0; this.durationCounter = 0; } } - public void handlePeriodicClick(int interval, MinecraftClient mc) { - if (++this.intervalCounter >= interval) { + public void handlePeriodicClick(int interval, MinecraftClient mc) + { + if (++this.intervalCounter >= interval) + { this.clickFunc.accept(mc); this.intervalCounter = 0; this.durationCounter = 0; } } - private void setKeyState(boolean state, MinecraftClient mc) { + private void setKeyState(boolean state, MinecraftClient mc) + { this.state = state; InputUtil.Key key = InputUtil.fromTranslationKey(this.keybind.getBoundKeyTranslationKey()); KeyBinding.setKeyPressed(key, state); - if (state) { + if (state) + { this.clickFunc.accept(mc); KeyBinding.onKeyPressed(key); } } } - public static void onTick(MinecraftClient mc) { + public static void onTick(MinecraftClient mc) + { ClientPlayerEntity player = mc.player; - if (player == null) { + if (player == null) + { return; } doPeriodicClicks(mc); doPotionWarnings(player); - if (FeatureToggle.TWEAK_REPAIR_MODE.getBooleanValue()) { + if (FeatureToggle.TWEAK_REPAIR_MODE.getBooleanValue()) + { InventoryUtils.repairModeSwapItems(player); } CameraEntity.movementTick(); } - public static void onGameLoop(MinecraftClient mc) { + public static void onGameLoop(MinecraftClient mc) + { PlacementTweaks.onTick(mc); // Reset the counters after rendering each frame @@ -123,8 +135,10 @@ public static void onGameLoop(MinecraftClient mc) { Tweakeroo.renderCountXPOrbs = 0; } - private static void doPeriodicClicks(MinecraftClient mc) { - if (GuiUtils.getCurrentScreen() == null) { + private static void doPeriodicClicks(MinecraftClient mc) + { + if (GuiUtils.getCurrentScreen() == null) + { handlePeriodicClicks( KEY_STATE_ATTACK, FeatureToggle.TWEAK_PERIODIC_HOLD_ATTACK, @@ -140,7 +154,9 @@ private static void doPeriodicClicks(MinecraftClient mc) { Configs.Generic.PERIODIC_HOLD_USE_INTERVAL, Configs.Generic.PERIODIC_HOLD_USE_DURATION, Configs.Generic.PERIODIC_USE_INTERVAL, mc); - } else { + } + else + { KEY_STATE_ATTACK.reset(); KEY_STATE_USE.reset(); } @@ -153,41 +169,54 @@ private static void handlePeriodicClicks( IConfigInteger cfgHoldClickInterval, IConfigInteger cfgHoldDuration, IConfigInteger cfgClickInterval, - MinecraftClient mc) { - if (cfgPeriodicHold.getBooleanValue()) { + MinecraftClient mc) + { + if (cfgPeriodicHold.getBooleanValue()) + { int interval = cfgHoldClickInterval.getIntegerValue(); int holdDuration = cfgHoldDuration.getIntegerValue(); keyState.handlePeriodicHold(interval, holdDuration, mc); - } else if (cfgPeriodicClick.getBooleanValue()) { + } + else if (cfgPeriodicClick.getBooleanValue()) + { int interval = cfgClickInterval.getIntegerValue(); keyState.handlePeriodicClick(interval, mc); - } else { + } + else + { keyState.reset(); } } - private static void doPotionWarnings(PlayerEntity player) { + private static void doPotionWarnings(PlayerEntity player) + { if (FeatureToggle.TWEAK_POTION_WARNING.getBooleanValue() && - ++potionWarningTimer >= 100) { + ++potionWarningTimer >= 100) + { potionWarningTimer = 0; Collection effects = player.getStatusEffects(); - if (effects.isEmpty() == false) { + if (effects.isEmpty() == false) + { int minDuration = -1; int count = 0; - for (StatusEffectInstance effectInstance : effects) { - if (potionWarningShouldInclude(effectInstance)) { + for (StatusEffectInstance effectInstance : effects) + { + if (potionWarningShouldInclude(effectInstance)) + { ++count; - if (effectInstance.getDuration() < minDuration || minDuration < 0) { + if (effectInstance.getDuration() < minDuration || minDuration < 0) + { minDuration = effectInstance.getDuration(); } } } - if (count > 0) { + if (count > 0) + { InfoUtils.printActionbarMessage("tweakeroo.message.potion_effects_running_out", Integer.valueOf(count), Integer.valueOf(minDuration / 20)); } @@ -195,15 +224,18 @@ private static void doPotionWarnings(PlayerEntity player) { } } - public static boolean isEntityAllowedByAttackingRestriction(EntityType type) { - if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) { - MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN - .getOptionListValue(); + public static boolean isEntityAllowedByAttackingRestriction(EntityType type) + { + if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) + { + MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN.getOptionListValue(); - if (messageOutputType == MessageOutputType.MESSAGE) { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, - "tweakeroo.message.warning.entity_type_attack_restriction"); - } else if (messageOutputType == MessageOutputType.ACTIONBAR) { + if (messageOutputType == MessageOutputType.MESSAGE) + { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, "tweakeroo.message.warning.entity_type_attack_restriction"); + } + else if (messageOutputType == MessageOutputType.ACTIONBAR) + { InfoUtils.printActionbarMessage("tweakeroo.message.warning.entity_type_attack_restriction"); } @@ -213,27 +245,31 @@ public static boolean isEntityAllowedByAttackingRestriction(EntityType type) return true; } - private static boolean potionWarningShouldInclude(StatusEffectInstance effect) { + + private static boolean potionWarningShouldInclude(StatusEffectInstance effect) + { return effect.isAmbient() == false && - (effect.getEffectType().value().isBeneficial() || - Configs.Generic.POTION_WARNING_BENEFICIAL_ONLY.getBooleanValue() == false) - && - effect.getDuration() <= Configs.Generic.POTION_WARNING_THRESHOLD.getIntegerValue() && - POTION_RESTRICTION.isAllowed(effect.getEffectType().value()); + (effect.getEffectType().isBeneficial() || + Configs.Generic.POTION_WARNING_BENEFICIAL_ONLY.getBooleanValue() == false) && + effect.getDuration() <= Configs.Generic.POTION_WARNING_THRESHOLD.getIntegerValue() && + POTION_RESTRICTION.isAllowed(effect.getEffectType()); } @Nullable - public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) { + public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) + { List list = new ArrayList<>(); String[] strings = blockString.split(","); final int count = strings.length; int thicknessSum = 0; - for (int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) + { String str = strings[i]; FlatChunkGeneratorLayer layer = parseLayerString(str, thicknessSum); - if (layer == null) { + if (layer == null) + { list = Collections.emptyList(); break; } @@ -246,18 +282,25 @@ public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) { } @Nullable - private static FlatChunkGeneratorLayer parseLayerString(String string, int startY) { + private static FlatChunkGeneratorLayer parseLayerString(String string, int startY) + { String[] strings = string.split("\\*", 2); int thickness; - if (strings.length == 2) { - try { + if (strings.length == 2) + { + try + { thickness = Math.max(Integer.parseInt(strings[0]), 0); - } catch (NumberFormatException e) { + } + catch (NumberFormatException e) + { Tweakeroo.logger.error("Error while parsing flat world string => {}", e.getMessage()); return null; } - } else { + } + else + { thickness = 1; } @@ -265,31 +308,40 @@ private static FlatChunkGeneratorLayer parseLayerString(String string, int start int finalThickness = endY - startY; Block block; - try { + try + { block = getBlockFromName(strings[strings.length - 1]); - } catch (Exception e) { + } + catch (Exception e) + { Tweakeroo.logger.error("Error while parsing flat world string => {}", e.getMessage()); return null; } - if (block == null) { - Tweakeroo.logger.error("Error while parsing flat world string => Unknown block, {}", - strings[strings.length - 1]); + if (block == null) + { + Tweakeroo.logger.error("Error while parsing flat world string => Unknown block, {}", strings[strings.length - 1]); return null; - } else { + } + else + { FlatChunkGeneratorLayer layer = new FlatChunkGeneratorLayer(finalThickness, block); // FIXME 1.17 is this just not needed anymore? - // layer.setStartY(startY); + //layer.setStartY(startY); return layer; } } @Nullable - private static Block getBlockFromName(String name) { - try { + private static Block getBlockFromName(String name) + { + try + { Identifier identifier = new Identifier(name); return Registries.BLOCK.getOrEmpty(identifier).orElse(null); - } catch (Exception e) { + } + catch (Exception e) + { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index fc7727c94..0cc87f61a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -2,23 +2,6 @@ import javax.annotation.Nullable; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.BlockUtils; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.malilib.util.InfoUtils; -import fi.dy.masa.malilib.util.MessageOutputType; -import fi.dy.masa.malilib.util.PositionUtils; -import fi.dy.masa.malilib.util.PositionUtils.HitPart; -import fi.dy.masa.malilib.util.restrictions.BlockRestriction; -import fi.dy.masa.malilib.util.restrictions.ItemRestriction; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.config.Hotkeys; -import fi.dy.masa.tweakeroo.util.CameraUtils; -import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; -import fi.dy.masa.tweakeroo.util.InventoryUtils; -import fi.dy.masa.tweakeroo.util.MiscUtils; -import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -50,7 +33,26 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -public class PlacementTweaks { +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.BlockUtils; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.malilib.util.InfoUtils; +import fi.dy.masa.malilib.util.MessageOutputType; +import fi.dy.masa.malilib.util.PositionUtils; +import fi.dy.masa.malilib.util.PositionUtils.HitPart; +import fi.dy.masa.malilib.util.restrictions.BlockRestriction; +import fi.dy.masa.malilib.util.restrictions.ItemRestriction; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.config.Hotkeys; +import fi.dy.masa.tweakeroo.util.CameraUtils; +import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; +import fi.dy.masa.tweakeroo.util.InventoryUtils; +import fi.dy.masa.tweakeroo.util.MiscUtils; +import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; + +public class PlacementTweaks +{ private static BlockPos posFirst = null; private static BlockPos posFirstBreaking = null; private static BlockPos posLast = null; @@ -69,85 +71,95 @@ public class PlacementTweaks { private static int placementCount; private static int hotbarSlot = -1; private static ItemStack stackClickedOn = ItemStack.EMPTY; - @Nullable - private static BlockState stateClickedOn = null; + @Nullable private static BlockState stateClickedOn = null; public static final BlockRestriction BLOCK_TYPE_BREAK_RESTRICTION = new BlockRestriction(); public static final BlockRestriction FAST_RIGHT_CLICK_BLOCK_RESTRICTION = new BlockRestriction(); public static final ItemRestriction FAST_RIGHT_CLICK_ITEM_RESTRICTION = new ItemRestriction(); public static final ItemRestriction FAST_PLACEMENT_ITEM_RESTRICTION = new ItemRestriction(); public static final ItemRestriction HAND_RESTOCK_RESTRICTION = new ItemRestriction(); - public static void onTick(MinecraftClient mc) { + public static void onTick(MinecraftClient mc) + { boolean attack = mc.options.attackKey.isPressed(); boolean use = mc.options.useKey.isPressed(); - if (GuiUtils.getCurrentScreen() == null) { - if (use) { + if (GuiUtils.getCurrentScreen() == null) + { + if (use) + { onUsingTick(); } - if (attack) { + if (attack) + { onAttackTick(mc); } - } else { + } + else + { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } - if (use == false) { + if (use == false) + { clearClickedBlockInfoUse(); - // Clear the cached stack when releasing both keys, so that the restock doesn't - // happen when + // Clear the cached stack when releasing both keys, so that the restock doesn't happen when // using another item or an empty hand. - if (attack == false) { + if (attack == false) + { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } } - if (attack == false) { + if (attack == false) + { clearClickedBlockInfoAttack(); } } - public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { + public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) + { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { - if (isEmulatedClick == false) { - // System.out.printf("onProcessRightClickPre storing stack: %s\n", - // stackOriginal); + stackOriginal.isEmpty() == false && + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) + { + if (isEmulatedClick == false) + { + //System.out.printf("onProcessRightClickPre storing stack: %s\n", stackOriginal); cacheStackInHand(hand); } - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is - // on + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.preRestockHand(player, hand, allowHotbar); } return InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player); } - public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { - // System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, - // current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); + public static void onProcessRightClickPost(PlayerEntity player, Hand hand) + { + //System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } - public static void onLeftClickMousePre() { + public static void onLeftClickMousePre() + { MinecraftClient mc = MinecraftClient.getInstance(); HitResult trace = mc.crosshairTarget; // Only set the position if it was null, otherwise the fast left click tweak // would just reset it every time. - if (trace != null && trace.getType() == HitResult.Type.BLOCK && posFirstBreaking == null) { + if (trace != null && trace.getType() == HitResult.Type.BLOCK && posFirstBreaking == null) + { posFirstBreaking = ((BlockHitResult) trace).getBlockPos(); sideFirstBreaking = ((BlockHitResult) trace).getSide(); } @@ -155,64 +167,75 @@ public static void onLeftClickMousePre() { onProcessRightClickPre(mc.player, Hand.MAIN_HAND); } - public static void onLeftClickMousePost() { - MinecraftClient mc = MinecraftClient.getInstance(); - onProcessRightClickPost(mc.player, Hand.MAIN_HAND); + public static void onLeftClickMousePost() + { + onProcessRightClickPost(MinecraftClient.getInstance().player, Hand.MAIN_HAND); } - public static void cacheStackInHand(Hand hand) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerEntity player = mc.player; + public static void cacheStackInHand(Hand hand) + { + PlayerEntity player = MinecraftClient.getInstance().player; ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { + stackOriginal.isEmpty() == false && + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) + { stackBeforeUse[hand.ordinal()] = stackOriginal.copy(); hotbarSlot = player.getInventory().selectedSlot; } } - private static void onAttackTick(MinecraftClient mc) { - if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { + private static void onAttackTick(MinecraftClient mc) + { + if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) + { if (mc.player.getAbilities().creativeMode || - (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() - || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) { + (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) + { final int count = Configs.Generic.FAST_LEFT_CLICK_COUNT.getIntegerValue(); - for (int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) + { isEmulatedClick = true; ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoAttack(); isEmulatedClick = false; } } - } else { + } + else + { InventoryUtils.trySwapCurrentToolIfNearlyBroken(); Hand hand = Hand.MAIN_HAND; tryRestockHand(mc.player, hand, stackBeforeUse[hand.ordinal()]); } } - private static void onUsingTick() { + private static void onUsingTick() + { MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.player == null) { + if (mc.player == null) + { return; } if (posFirst != null && FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() && - canUseItemWithRestriction(FAST_PLACEMENT_ITEM_RESTRICTION, mc.player)) { + canUseItemWithRestriction(FAST_PLACEMENT_ITEM_RESTRICTION, mc.player)) + { ClientPlayerEntity player = mc.player; World world = player.getEntityWorld(); - final double reach = mc.player.getBlockInteractionRange(); + final double reach = mc.interactionManager.getReachDistance(); final int maxCount = Configs.Generic.FAST_BLOCK_PLACEMENT_COUNT.getIntegerValue(); mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); - for (int i = 0; i < maxCount; ++i) { + for (int i = 0; i < maxCount; ++i) + { HitResult trace = mc.crosshairTarget; - if (trace == null || trace.getType() != HitResult.Type.BLOCK) { + if (trace == null || trace.getType() != HitResult.Type.BLOCK) + { break; } @@ -228,46 +251,55 @@ private static void onUsingTick() { ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); if (hand != null && - posNew.equals(posLast) == false && - canPlaceBlockIntoPosition(world, posNew, ctx) && - isPositionAllowedByPlacementRestriction(posNew, side) && - canPlaceBlockAgainst(world, pos, player, hand)) { + posNew.equals(posLast) == false && + canPlaceBlockIntoPosition(world, posNew, ctx) && + isPositionAllowedByPlacementRestriction(posNew, side) && + canPlaceBlockAgainst(world, pos, player, hand) + ) + { /* - * IBlockState state = world.getBlockState(pos); - * float x = (float) (trace.hitVec.x - pos.getX()); - * float y = (float) (trace.hitVec.y - pos.getY()); - * float z = (float) (trace.hitVec.z - pos.getZ()); - * - * if (state.getBlock().onBlockActivated(world, posNew, state, player, hand, - * side, x, y, z)) - * { - * return; - * } - */ + IBlockState state = world.getBlockState(pos); + float x = (float) (trace.hitVec.x - pos.getX()); + float y = (float) (trace.hitVec.y - pos.getY()); + float z = (float) (trace.hitVec.z - pos.getZ()); + + if (state.getBlock().onBlockActivated(world, posNew, state, player, hand, side, x, y, z)) + { + return; + } + */ hitVec = hitVecFirst.add(posNew.getX(), posNew.getY(), posNew.getZ()); ActionResult result = tryPlaceBlock(mc.interactionManager, player, mc.world, posNew, sideFirst, sideRotatedFirst, playerYawFirst, hitVec, hand, hitPartFirst, false); - if (result == ActionResult.SUCCESS) { + if (result == ActionResult.SUCCESS) + { posLast = posNew; mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); - } else { + } + else + { break; } - } else { + } + else + { break; } } // Reset the timer to prevent the regular process method from re-firing ((IMinecraftClientInvoker) mc).tweakeroo_setItemUseCooldown(4); - } else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && + } + else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && mc.options.useKey.isPressed() && - canUseFastRightClick(mc.player)) { + canUseFastRightClick(mc.player)) + { final int count = Configs.Generic.FAST_RIGHT_CLICK_COUNT.getIntegerValue(); - for (int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) + { isEmulatedClick = true; ((IMinecraftClientInvoker) mc).tweakeroo_invokeDoItemUse(); isEmulatedClick = false; @@ -280,8 +312,10 @@ public static ActionResult onProcessRightClickBlock( ClientPlayerEntity player, ClientWorld world, Hand hand, - BlockHitResult hitResult) { - if (CameraUtils.shouldPreventPlayerInputs()) { + BlockHitResult hitResult) + { + if (CameraUtils.shouldPreventPlayerInputs()) + { return ActionResult.PASS; } @@ -291,20 +325,21 @@ public static ActionResult onProcessRightClickBlock( BlockPos posIn = hitResult.getBlockPos(); if (Configs.Disable.DISABLE_AXE_STRIPPING.getBooleanValue() && - stackPre.getItem() instanceof AxeItem && - MiscUtils.isStrippableLog(world, posIn)) { + stackPre.getItem() instanceof AxeItem && + MiscUtils.isStrippableLog(world, posIn)) + { return ActionResult.PASS; } if (Configs.Disable.DISABLE_SHOVEL_PATHING.getBooleanValue() && - stackPre.getItem() instanceof ShovelItem && - MiscUtils.isShovelPathConvertableBlock(world, posIn)) { + stackPre.getItem() instanceof ShovelItem && + MiscUtils.isShovelPathConvertableBlock(world, posIn)) + { return ActionResult.PASS; } stackPre = stackPre.copy(); - boolean restricted = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() - || FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); + boolean restricted = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() || FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); Direction sideIn = hitResult.getSide(); Vec3d hitVec = hitResult.getPos(); Direction playerFacingH = player.getHorizontalFacing(); @@ -314,23 +349,24 @@ public static ActionResult onProcessRightClickBlock( cacheStackInHand(hand); - if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue() && stateClickedOn == null) { + if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue() && stateClickedOn == null) + { BlockState state = world.getBlockState(posIn); stackClickedOn = state.getBlock().getPickStack(world, posIn, state); stateClickedOn = state; } - if (canPlaceBlockAgainst(world, posIn, player, hand) == false) { + if (canPlaceBlockAgainst(world, posIn, player, hand) == false) + { return ActionResult.PASS; } - // System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, - // hitVec: %s\n", posIn, sideIn, hitPart, hitVec); - ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, - hitPart, true); + //System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); + ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); // Store the initial click data for the fast placement mode - if (posFirst == null && result == ActionResult.SUCCESS && restricted) { + if (posFirst == null && result == ActionResult.SUCCESS && restricted) + { boolean flexible = FeatureToggle.TWEAK_FLEXIBLE_BLOCK_PLACEMENT.getBooleanValue(); boolean accurate = FeatureToggle.TWEAK_ACCURATE_BLOCK_PLACEMENT.getBooleanValue(); boolean rotation = Hotkeys.FLEXIBLE_BLOCK_PLACEMENT_ROTATION.getKeybind().isKeybindHeld(); @@ -351,7 +387,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - // System.out.printf("plop store @ %s\n", posFirst); + //System.out.printf("plop store @ %s\n", posFirst); } return result; @@ -368,7 +404,8 @@ private static ActionResult tryPlaceBlock( Vec3d hitVec, Hand hand, HitPart hitPart, - boolean isFirstClick) { + boolean isFirstClick) + { Direction side = sideIn; boolean handleFlexible = false; BlockPos posNew = null; @@ -381,33 +418,35 @@ private static ActionResult tryPlaceBlock( boolean offset = offsetHeld || (rememberFlexible && firstWasOffset); ItemStack stack = player.getStackInHand(hand); - if (flexible) { + if (flexible) + { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - posNew = isFirstClick && (rotation || offset || adjacent) - ? getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx) - : posIn; + posNew = isFirstClick && (rotation || offset || adjacent) ? getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx) : posIn; // Place the block into the adjacent position - if (adjacent && hitPart != null && hitPart != HitPart.CENTER) { + if (adjacent && hitPart != null && hitPart != HitPart.CENTER) + { posNew = posNew.offset(sideRotatedIn.getOpposite()).offset(sideIn.getOpposite()); - hitVec = hitVec - .add(Vec3d.of(sideRotatedIn.getOpposite().getVector().add(sideIn.getOpposite().getVector()))); + hitVec = hitVec.add(Vec3d.of(sideRotatedIn.getOpposite().getVector().add(sideIn.getOpposite().getVector()))); handleFlexible = true; } - // Place the block facing/against the adjacent block (= just rotated from - // normal) - if (rotation) { + // Place the block facing/against the adjacent block (= just rotated from normal) + if (rotation) + { side = sideRotatedIn; handleFlexible = true; - } else { + } + else + { // Don't rotate the player facing in handleFlexibleBlockPlacement() hitPart = null; } // Place the block into the diagonal position - if (offset) { + if (offset) + { posNew = posNew.offset(sideRotatedIn.getOpposite()); hitVec = hitVec.add(Vec3d.of(sideRotatedIn.getOpposite().getVector())); handleFlexible = true; @@ -417,8 +456,9 @@ private static ActionResult tryPlaceBlock( boolean simpleOffset = false; if (handleFlexible == false && - FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && - stack.getItem() instanceof BlockItem) { + FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && + stack.getItem() instanceof BlockItem) + { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); posNew = getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx); @@ -430,35 +470,43 @@ private static ActionResult tryPlaceBlock( boolean accurateReverse = Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); boolean afterClicker = FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue(); - if (accurate && (accurateIn || accurateReverse || afterClicker)) { + if (accurate && (accurateIn || accurateReverse || afterClicker)) + { Direction facing = side; boolean handleAccurate = false; - if (posNew == null) { - if (flexible == false || isFirstClick == false) { + if (posNew == null) + { + if (flexible == false || isFirstClick == false) + { posNew = posIn; - } else { + } + else + { BlockHitResult hitResult = new BlockHitResult(hitVec, side, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); posNew = getPlacementPositionForTargetedPosition(world, posIn, side, ctx); } } - if (accurateIn) { + if (accurateIn) + { facing = sideIn; hitPart = null; handleAccurate = true; - // Pistons, Droppers, Dispensers should face into the block, but Observers - // should point their back/output + // Pistons, Droppers, Dispensers should face into the block, but Observers should point their back/output // side into the block when the Accurate Placement In hotkey is used - if ((stack.getItem() instanceof BlockItem) == false - || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) { + if ((stack.getItem() instanceof BlockItem) == false || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) + { facing = facing.getOpposite(); } - // System.out.printf("accurate - IN - facing: %s\n", facing); - } else if (flexible == false || rotation == false) { - if (stack.getItem() instanceof BlockItem) { + //System.out.printf("accurate - IN - facing: %s\n", facing); + } + else if (flexible == false || rotation == false) + { + if (stack.getItem() instanceof BlockItem) + { BlockHitResult hitResult = new BlockHitResult(hitVec, sideIn, posNew, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); @@ -472,27 +520,30 @@ private static ActionResult tryPlaceBlock( BlockState state = item.getBlock().getPlacementState(ctx); // getStateForPlacement can return null in 1.13+ - if (state == null) { + if (state == null) + { return ActionResult.PASS; } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - // System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: - // %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, - // player), posNew); + //System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); - if (facingTmp != null) { + if (facingTmp != null) + { facing = facingTmp; } - } else { + } + else + { facing = player.getHorizontalFacing(); } } - if (accurateReverse) { - // System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", - // facing, facing.getOpposite()); - if (accurateIn || flexible == false || rotation == false) { + if (accurateReverse) + { + //System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); + if (accurateIn || flexible == false || rotation == false) + { facing = facing.getOpposite(); } @@ -500,80 +551,89 @@ private static ActionResult tryPlaceBlock( handleAccurate = true; } - if ((handleAccurate || afterClicker) - && Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue()) { + if ((handleAccurate || afterClicker) && Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue()) + { // Carpet-Extra mod accurate block placement protocol support double relX = hitVec.x - posNew.getX(); double x = hitVec.x; - int afterClickerClickCount = MathHelper - .clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); + int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); - if (handleAccurate && isFacingValidFor(facing, stack)) { + if (handleAccurate && isFacingValidFor(facing, stack)) + { x = posNew.getX() + relX + 2 + (facing.getId() * 2); } - if (afterClicker) { + if (afterClicker) + { x += afterClickerClickCount * 16; } - // System.out.printf("accurate - pre hitVec: %s\n", hitVec); - // System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: - // %s, side: %s\n", facing, x, pos, side); + //System.out.printf("accurate - pre hitVec: %s\n", hitVec); + //System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - // System.out.printf("accurate - post hitVec: %s\n", hitVec); + //System.out.printf("accurate - post hitVec: %s\n", hitVec); } - // System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", - // facing, side, posNew, hitVec); + //System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } - if (handleFlexible) { + if (handleFlexible) + { BlockHitResult hitResult = new BlockHitResult(hitVec, side, posNew, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - if (canPlaceBlockIntoPosition(world, posNew, ctx)) { - // System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: - // %s\n", posNew, side, hitPart, hitVec); - return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, - hitPart); - } else { + if (canPlaceBlockIntoPosition(world, posNew, ctx)) + { + //System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posNew, side, hitPart, hitVec); + return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); + } + else + { return ActionResult.PASS; } } - if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) { - return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, - null); + if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) + { + return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, null); } - return processRightClickBlockWrapper(controller, player, world, simpleOffset ? posNew : posIn, sideIn, hitVec, - hand); + return processRightClickBlockWrapper(controller, player, world, simpleOffset ? posNew : posIn, sideIn, hitVec, hand); } - private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEntity player, Hand hand) { - if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue()) { + private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEntity player, Hand hand) + { + if (FeatureToggle.TWEAK_PLACEMENT_REST_FIRST.getBooleanValue()) + { BlockState state = world.getBlockState(pos); - if (stackClickedOn.isEmpty() == false) { + if (stackClickedOn.isEmpty() == false) + { ItemStack stack = state.getBlock().getPickStack(world, pos, state); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) + { return false; } - } else { - if (state != stateClickedOn) { + } + else + { + if (state != stateClickedOn) + { return false; } } } - if (FeatureToggle.TWEAK_PLACEMENT_REST_HAND.getBooleanValue()) { + if (FeatureToggle.TWEAK_PLACEMENT_REST_HAND.getBooleanValue()) + { BlockState state = world.getBlockState(pos); ItemStack stackClicked = state.getBlock().getPickStack(world, pos, state); ItemStack stackHand = player.getStackInHand(hand); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) + { return false; } } @@ -581,28 +641,34 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt return true; } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, Hand hand, PlayerEntity player) { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, Hand hand, PlayerEntity player) + { ItemStack stack = player.getStackInHand(hand); return canUseItemWithRestriction(restriction, stack); } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, ItemStack stack) { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, ItemStack stack) + { return stack.isEmpty() || restriction.isAllowed(stack.getItem()); } - public static boolean canUseItemWithRestriction(ItemRestriction restriction, PlayerEntity player) { + public static boolean canUseItemWithRestriction(ItemRestriction restriction, PlayerEntity player) + { return canUseItemWithRestriction(restriction, Hand.MAIN_HAND, player) && - canUseItemWithRestriction(restriction, Hand.OFF_HAND, player); + canUseItemWithRestriction(restriction, Hand.OFF_HAND, player); } - private static boolean canUseFastRightClick(PlayerEntity player) { - if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) { + private static boolean canUseFastRightClick(PlayerEntity player) + { + if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) + { return false; } HitResult trace = player.raycast(6, 0f, false); - if (trace == null || trace.getType() != HitResult.Type.BLOCK) { + if (trace == null || trace.getType() != HitResult.Type.BLOCK) + { return FAST_RIGHT_CLICK_BLOCK_RESTRICTION.isAllowed(Blocks.AIR); } @@ -611,17 +677,19 @@ private static boolean canUseFastRightClick(PlayerEntity player) { return FAST_RIGHT_CLICK_BLOCK_RESTRICTION.isAllowed(block); } - public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stackOriginal) { + public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stackOriginal) + { if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { + canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) + { ItemStack stackCurrent = player.getStackInHand(hand); if (stackOriginal.isEmpty() == false && player.getInventory().selectedSlot == hotbarSlot && - (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) { - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is - // on + (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) + { + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.restockNewStackToHand(player, hand, stackOriginal, allowHotbar); } } @@ -634,24 +702,23 @@ private static ActionResult processRightClickBlockWrapper( BlockPos posIn, Direction sideIn, Vec3d hitVecIn, - Hand hand) { - // System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, - // hand: %s\n", pos, side, hand); + Hand hand) + { + //System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); if (FeatureToggle.TWEAK_PLACEMENT_LIMIT.getBooleanValue() && - placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) { + placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) + { return ActionResult.PASS; } - // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is - // on + // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.preRestockHand(player, hand, allowHotbar); // We need to grab the stack here if the cached stack is still empty, - // because this code runs before the cached stack gets set on the first - // click/use. + // because this code runs before the cached stack gets set on the first click/use. BlockHitResult hitResult = new BlockHitResult(hitVecIn, sideIn, posIn, false); ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); BlockPos posPlacement = getPlacementPositionForTargetedPosition(world, posIn, sideIn, ctx); @@ -660,31 +727,33 @@ private static ActionResult processRightClickBlockWrapper( ItemStack stackOriginal; if (stackBeforeUse[hand.ordinal()].isEmpty() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false) { + FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false) + { stackOriginal = stackBeforeUse[hand.ordinal()]; - } else { + } + else + { stackOriginal = player.getStackInHand(hand).copy(); } if (FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue() && - state.canReplace(ctx) == false && state.isReplaceable()) { + state.canReplace(ctx) == false && state.isReplaceable()) + { // If the block itself says it's not replaceable, but the material is (fluids), // then we need to offset the position back, otherwise the check in ItemBlock // will offset the position by one forward from the desired position. - // FIXME This will break if the block behind the desired position is replaceable - // though... >_> + // FIXME This will break if the block behind the desired position is replaceable though... >_> posIn = posIn.offset(sideIn.getOpposite()); } - if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) { - // System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", - // pos, side); + if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) + { + //System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); return ActionResult.PASS; } - final int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), - 0, 32); + final int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); Direction facing = sideIn; boolean flexible = FeatureToggle.TWEAK_FLEXIBLE_BLOCK_PLACEMENT.getBooleanValue(); @@ -692,90 +761,100 @@ private static ActionResult processRightClickBlockWrapper( boolean rememberFlexible = Configs.Generic.REMEMBER_FLEXIBLE.getBooleanValue(); boolean rotation = rotationHeld || (rememberFlexible && firstWasRotation); boolean accurate = FeatureToggle.TWEAK_ACCURATE_BLOCK_PLACEMENT.getBooleanValue(); - boolean keys = Hotkeys.ACCURATE_BLOCK_PLACEMENT_IN.getKeybind().isKeybindHeld() - || Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); + boolean keys = Hotkeys.ACCURATE_BLOCK_PLACEMENT_IN.getKeybind().isKeybindHeld() || Hotkeys.ACCURATE_BLOCK_PLACEMENT_REVERSE.getKeybind().isKeybindHeld(); accurate = accurate && keys; // Carpet-Extra mod accurate block placement protocol support if (flexible && rotation && accurate == false && - Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && - isFacingValidFor(facing, stackOriginal)) { + Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && + isFacingValidFor(facing, stackOriginal)) + { facing = facing.getOpposite(); // go from block face to click on to the requested facing - // double relX = hitVecIn.x - posIn.getX(); - // double x = posIn.getX() + relX + 2 + (facing.getId() * 2); + //double relX = hitVecIn.x - posIn.getX(); + //double x = posIn.getX() + relX + 2 + (facing.getId() * 2); double x = posIn.getX() + 2 + (facing.getId() * 2); - if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue()) { + if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue()) + { x += afterClickerClickCount * 16; } - // System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, - // pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); + //System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } - if (FeatureToggle.TWEAK_Y_MIRROR.getBooleanValue() && Hotkeys.PLACEMENT_Y_MIRROR.getKeybind().isKeybindHeld()) { + if (FeatureToggle.TWEAK_Y_MIRROR.getBooleanValue() && Hotkeys.PLACEMENT_Y_MIRROR.getKeybind().isKeybindHeld()) + { double y = 1 - hitVecIn.y + 2 * posIn.getY(); // = 1 - (hitVec.y - pos.getY()) + pos.getY(); hitVecIn = new Vec3d(hitVecIn.x, y, hitVecIn.z); - if (sideIn.getAxis() == Direction.Axis.Y) { + if (sideIn.getAxis() == Direction.Axis.Y) + { posIn = posIn.offset(sideIn); sideIn = sideIn.getOpposite(); } } - if (FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue()) { + if (FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue()) + { InventoryUtils.switchToPickedBlock(); } InventoryUtils.trySwapCurrentToolIfNearlyBroken(); - // System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: - // %s\n", pos, side, hitVec); + //System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); ActionResult result; - if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) { + if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) + { result = ActionResult.PASS; - } else { - // System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: - // %s\n", pos, side, hitVec); + } + else + { + //System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posIn, false); result = controller.interactBlock(player, hand, context); } - if (result == ActionResult.SUCCESS) { + if (result == ActionResult.SUCCESS) + { placementCount++; } // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - // System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, - // current: %s\n", stackOriginal, player.getHeldItem(hand)); + //System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && - Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() == false && - world.getBlockState(posPlacement) != stateBefore) { - for (int i = 0; i < afterClickerClickCount; i++) { - // System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, - // pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); + Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() == false && + world.getBlockState(posPlacement) != stateBefore) + { + for (int i = 0; i < afterClickerClickCount; i++) + { + //System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posPlacement, false); result = controller.interactBlock(player, hand, context); } } - if (result == ActionResult.SUCCESS) { + if (result == ActionResult.SUCCESS) + { PlayerInventory inv = player.getInventory(); - if (FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue()) { + if (FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue()) + { int newSlot = inv.selectedSlot + 1; - if (newSlot >= 9 || newSlot >= Configs.Generic.HOTBAR_SLOT_CYCLE_MAX.getIntegerValue()) { + if (newSlot >= 9 || newSlot >= Configs.Generic.HOTBAR_SLOT_CYCLE_MAX.getIntegerValue()) + { newSlot = 0; } inv.selectedSlot = newSlot; - } else if (FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue()) { + } + else if (FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue()) + { int newSlot = player.getRandom().nextInt(Configs.Generic.HOTBAR_SLOT_RANDOMIZER_MAX.getIntegerValue()); inv.selectedSlot = newSlot; } @@ -793,15 +872,21 @@ private static ActionResult handleFlexibleBlockPlacement( float playerYaw, Vec3d hitVec, Hand hand, - @Nullable HitPart hitPart) { + @Nullable HitPart hitPart) + { Direction facing = Direction.fromHorizontal(MathHelper.floor((playerYaw * 4.0F / 360.0F) + 0.5D) & 3); float yawOrig = player.getYaw(); - if (hitPart == HitPart.CENTER) { + if (hitPart == HitPart.CENTER) + { facing = facing.getOpposite(); - } else if (hitPart == HitPart.LEFT) { + } + else if (hitPart == HitPart.LEFT) + { facing = facing.rotateYCounterclockwise(); - } else if (hitPart == HitPart.RIGHT) { + } + else if (hitPart == HitPart.RIGHT) + { facing = facing.rotateYClockwise(); } @@ -810,8 +895,7 @@ private static ActionResult handleFlexibleBlockPlacement( player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - // System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing - // orig: %s facing new: %s\n", pos, side, facingOrig, facing); + //System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); @@ -820,7 +904,8 @@ private static ActionResult handleFlexibleBlockPlacement( return result; } - private static void clearClickedBlockInfoUse() { + private static void clearClickedBlockInfoUse() + { posFirst = null; hitPartFirst = null; hitVecFirst = null; @@ -834,76 +919,75 @@ private static void clearClickedBlockInfoUse() { stateClickedOn = null; } - private static void clearClickedBlockInfoAttack() { + private static void clearClickedBlockInfoAttack() + { posFirstBreaking = null; sideFirstBreaking = null; } - private static Direction getRotatedFacing(Direction originalSide, Direction playerFacingH, HitPart hitPart) { - if (originalSide.getAxis().isVertical()) { - switch (hitPart) { - case LEFT: - return playerFacingH.rotateYClockwise(); - case RIGHT: - return playerFacingH.rotateYCounterclockwise(); - case BOTTOM: - return originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); - case TOP: - return originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); - case CENTER: - return originalSide.getOpposite(); - default: - return originalSide; + private static Direction getRotatedFacing(Direction originalSide, Direction playerFacingH, HitPart hitPart) + { + if (originalSide.getAxis().isVertical()) + { + switch (hitPart) + { + case LEFT: return playerFacingH.rotateYClockwise(); + case RIGHT: return playerFacingH.rotateYCounterclockwise(); + case BOTTOM: return originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); + case TOP: return originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); + case CENTER: return originalSide.getOpposite(); + default: return originalSide; } - } else { - switch (hitPart) { - case LEFT: - return originalSide.rotateYCounterclockwise(); - case RIGHT: - return originalSide.rotateYClockwise(); - case BOTTOM: - return Direction.UP; - case TOP: - return Direction.DOWN; - case CENTER: - return originalSide.getOpposite(); - default: - return originalSide; + } + else + { + switch (hitPart) + { + case LEFT: return originalSide.rotateYCounterclockwise(); + case RIGHT: return originalSide.rotateYClockwise(); + case BOTTOM: return Direction.UP; + case TOP: return Direction.DOWN; + case CENTER: return originalSide.getOpposite(); + default: return originalSide; } } } - private static boolean isPositionAllowedByPlacementRestriction(BlockPos pos, Direction side) { + private static boolean isPositionAllowedByPlacementRestriction(BlockPos pos, Direction side) + { boolean restrictionEnabled = FeatureToggle.TWEAK_PLACEMENT_RESTRICTION.getBooleanValue(); boolean gridEnabled = FeatureToggle.TWEAK_PLACEMENT_GRID.getBooleanValue(); - if (restrictionEnabled == false && gridEnabled == false) { + if (restrictionEnabled == false && gridEnabled == false) + { return true; } int gridSize = Configs.Generic.PLACEMENT_GRID_SIZE.getIntegerValue(); - PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.PLACEMENT_RESTRICTION_MODE - .getOptionListValue(); + PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.PLACEMENT_RESTRICTION_MODE.getOptionListValue(); - return isPositionAllowedByRestrictions(pos, side, posFirst, sideFirst, restrictionEnabled, mode, gridEnabled, - gridSize); + return isPositionAllowedByRestrictions(pos, side, posFirst, sideFirst, restrictionEnabled, mode, gridEnabled, gridSize); } - public static boolean isPositionAllowedByBreakingRestriction(BlockPos pos, Direction side) { + public static boolean isPositionAllowedByBreakingRestriction(BlockPos pos, Direction side) + { MinecraftClient mc = MinecraftClient.getInstance(); World world = mc.world; - if (world != null && FeatureToggle.TWEAK_BLOCK_TYPE_BREAK_RESTRICTION.getBooleanValue()) { + if (world != null && FeatureToggle.TWEAK_BLOCK_TYPE_BREAK_RESTRICTION.getBooleanValue()) + { BlockState state = world.getBlockState(pos); - if (BLOCK_TYPE_BREAK_RESTRICTION.isAllowed(state.getBlock()) == false) { - MessageOutputType type = (MessageOutputType) Configs.Generic.BLOCK_TYPE_BREAK_RESTRICTION_WARN - .getOptionListValue(); + if (BLOCK_TYPE_BREAK_RESTRICTION.isAllowed(state.getBlock()) == false) + { + MessageOutputType type = (MessageOutputType) Configs.Generic.BLOCK_TYPE_BREAK_RESTRICTION_WARN.getOptionListValue(); - if (type == MessageOutputType.MESSAGE) { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, - "tweakeroo.message.warning.block_type_break_restriction"); - } else if (type == MessageOutputType.ACTIONBAR) { + if (type == MessageOutputType.MESSAGE) + { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.WARNING, "tweakeroo.message.warning.block_type_break_restriction"); + } + else if (type == MessageOutputType.ACTIONBAR) + { InfoUtils.printActionbarMessage("tweakeroo.message.warning.block_type_break_restriction"); } @@ -914,60 +998,62 @@ public static boolean isPositionAllowedByBreakingRestriction(BlockPos pos, Direc boolean restrictionEnabled = FeatureToggle.TWEAK_BREAKING_RESTRICTION.getBooleanValue(); boolean gridEnabled = FeatureToggle.TWEAK_BREAKING_GRID.getBooleanValue(); - if (restrictionEnabled == false && gridEnabled == false) { + if (restrictionEnabled == false && gridEnabled == false) + { return true; } int gridSize = Configs.Generic.BREAKING_GRID_SIZE.getIntegerValue(); - PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.BREAKING_RESTRICTION_MODE - .getOptionListValue(); + PlacementRestrictionMode mode = (PlacementRestrictionMode) Configs.Generic.BREAKING_RESTRICTION_MODE.getOptionListValue(); - return posFirstBreaking == null || isPositionAllowedByRestrictions(pos, side, posFirstBreaking, - sideFirstBreaking, restrictionEnabled, mode, gridEnabled, gridSize); + return posFirstBreaking == null || isPositionAllowedByRestrictions(pos, side, posFirstBreaking, sideFirstBreaking, restrictionEnabled, mode, gridEnabled, gridSize); } private static boolean isPositionAllowedByRestrictions(BlockPos pos, Direction side, - BlockPos posFirst, Direction sideFirst, boolean restrictionEnabled, PlacementRestrictionMode mode, - boolean gridEnabled, int gridSize) { - if (gridEnabled) { + BlockPos posFirst, Direction sideFirst, boolean restrictionEnabled, PlacementRestrictionMode mode, boolean gridEnabled, int gridSize) + { + if (gridEnabled) + { if ((Math.abs(pos.getX() - posFirst.getX()) % gridSize) != 0 || - (Math.abs(pos.getY() - posFirst.getY()) % gridSize) != 0 || - (Math.abs(pos.getZ() - posFirst.getZ()) % gridSize) != 0) { + (Math.abs(pos.getY() - posFirst.getY()) % gridSize) != 0 || + (Math.abs(pos.getZ() - posFirst.getZ()) % gridSize) != 0) + { return false; } } - if (restrictionEnabled) { - switch (mode) { - case COLUMN: - return isNewPositionValidForColumnMode(pos, posFirst, sideFirst); - case DIAGONAL: - return isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); - case FACE: - return isNewPositionValidForFaceMode(pos, side, sideFirst); - case LAYER: - return isNewPositionValidForLayerMode(pos, posFirst, sideFirst); - case LINE: - return isNewPositionValidForLineMode(pos, posFirst, sideFirst); - case PLANE: - return isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); - default: - return true; + if (restrictionEnabled) + { + switch (mode) + { + case COLUMN: return isNewPositionValidForColumnMode(pos, posFirst, sideFirst); + case DIAGONAL: return isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); + case FACE: return isNewPositionValidForFaceMode(pos, side, sideFirst); + case LAYER: return isNewPositionValidForLayerMode(pos, posFirst, sideFirst); + case LINE: return isNewPositionValidForLineMode(pos, posFirst, sideFirst); + case PLANE: return isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); + default: return true; } - } else { + } + else + { return true; } } - private static boolean isFacingValidFor(Direction facing, ItemStack stack) { + private static boolean isFacingValidFor(Direction facing, ItemStack stack) + { Item item = stack.getItem(); - if (stack.isEmpty() == false && item instanceof BlockItem) { + if (stack.isEmpty() == false && item instanceof BlockItem) + { Block block = ((BlockItem) item).getBlock(); BlockState state = block.getDefaultState(); - for (Property prop : state.getProperties()) { - if (prop instanceof DirectionProperty) { + for (Property prop : state.getProperties()) + { + if (prop instanceof DirectionProperty) + { return ((DirectionProperty) prop).getValues().contains(facing); } } @@ -976,92 +1062,87 @@ private static boolean isFacingValidFor(Direction facing, ItemStack stack) { return false; } - private static BlockPos getPlacementPositionForTargetedPosition(World world, BlockPos pos, Direction side, - ItemPlacementContext useContext) { - if (canPlaceBlockIntoPosition(world, pos, useContext)) { + private static BlockPos getPlacementPositionForTargetedPosition(World world, BlockPos pos, Direction side, ItemPlacementContext useContext) + { + if (canPlaceBlockIntoPosition(world, pos, useContext)) + { return pos; } return pos.offset(side); } - private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) { + private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) + { BlockState state = world.getBlockState(pos); - // boolean isLiquid = state.settings.liquid aka state.liquid -- no call for this - // exists return state.canReplace(useContext) || state.isLiquid() || state.isReplaceable(); } - private static boolean isNewPositionValidForColumnMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { + private static boolean isNewPositionValidForColumnMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) + { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) { - case X: - return posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); - case Y: - return posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); - case Z: - return posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); + switch (axis) + { + case X: return posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); + case Y: return posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); + case Z: return posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); default: return false; } } - private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { + private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) + { Direction.Axis axis = sideFirst.getAxis(); BlockPos relativePos = posNew.subtract(posFirst); - switch (axis) { - case X: - return posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); - case Y: - return posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); - case Z: - return posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); + switch (axis) + { + case X: return posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); + case Y: return posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); + case Z: return posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); default: return false; } } - private static boolean isNewPositionValidForFaceMode(BlockPos posNew, Direction side, Direction sideFirst) { + private static boolean isNewPositionValidForFaceMode(BlockPos posNew, Direction side, Direction sideFirst) + { return side == sideFirst; } - private static boolean isNewPositionValidForLayerMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { + private static boolean isNewPositionValidForLayerMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) + { return posNew.getY() == posFirst.getY(); } - private static boolean isNewPositionValidForLineMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { + private static boolean isNewPositionValidForLineMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) + { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) { - case X: - return posNew.getX() == posFirst.getX() - && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); - case Y: - return posNew.getY() == posFirst.getY() - && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); - case Z: - return posNew.getZ() == posFirst.getZ() - && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); + switch (axis) + { + case X: return posNew.getX() == posFirst.getX() && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); + case Y: return posNew.getY() == posFirst.getY() && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); + case Z: return posNew.getZ() == posFirst.getZ() && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); default: return false; } } - private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { + private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) + { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) { - case X: - return posNew.getX() == posFirst.getX(); - case Y: - return posNew.getY() == posFirst.getY(); - case Z: - return posNew.getZ() == posFirst.getZ(); + switch (axis) + { + case X: return posNew.getX() == posFirst.getX(); + case Y: return posNew.getY() == posFirst.getY(); + case Z: return posNew.getZ() == posFirst.getZ(); default: return false; @@ -1069,86 +1150,84 @@ private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos } /* - * @Nullable - * private static Direction getPlayerMovementDirection(PlayerEntitySP player) - * { - * double dx = player.posX - playerPosLast.x; - * double dy = player.posY - playerPosLast.y; - * double dz = player.posZ - playerPosLast.z; - * double ax = Math.abs(dx); - * double ay = Math.abs(dy); - * double az = Math.abs(dz); - * - * if (Math.max(Math.max(ax, az), ay) < 0.001) - * { - * return null; - * } - * - * if (ax > az) - * { - * if (ax > ay) - * { - * return dx > 0 ? Direction.EAST : Direction.WEST; - * } - * else - * { - * return dy > 0 ? Direction.UP : Direction.DOWN; - * } - * } - * else - * { - * if (az > ay) - * { - * return dz > 0 ? Direction.SOUTH : Direction.NORTH; - * } - * else - * { - * return dy > 0 ? Direction.UP : Direction.DOWN; - * } - * } - * } - * - * @Nullable - * private static Hand getHandWithItem(ItemStack stack, PlayerEntitySP player) - * { - * if - * (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemMainhand(), - * stackFirst)) - * { - * return Hand.MAIN; - * } - * - * if - * (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemOffhand(), - * stackFirst)) - * { - * return Hand.OFF; - * } - * - * return null; - * } - */ - - public static boolean shouldSkipSlotSync(int slotNumber, ItemStack newStack) { + @Nullable + private static Direction getPlayerMovementDirection(PlayerEntitySP player) + { + double dx = player.posX - playerPosLast.x; + double dy = player.posY - playerPosLast.y; + double dz = player.posZ - playerPosLast.z; + double ax = Math.abs(dx); + double ay = Math.abs(dy); + double az = Math.abs(dz); + + if (Math.max(Math.max(ax, az), ay) < 0.001) + { + return null; + } + + if (ax > az) + { + if (ax > ay) + { + return dx > 0 ? Direction.EAST : Direction.WEST; + } + else + { + return dy > 0 ? Direction.UP : Direction.DOWN; + } + } + else + { + if (az > ay) + { + return dz > 0 ? Direction.SOUTH : Direction.NORTH; + } + else + { + return dy > 0 ? Direction.UP : Direction.DOWN; + } + } + } + + @Nullable + private static Hand getHandWithItem(ItemStack stack, PlayerEntitySP player) + { + if (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemMainhand(), stackFirst)) + { + return Hand.MAIN; + } + + if (InventoryUtils.areStacksEqualIgnoreDurability(player.getHeldItemOffhand(), stackFirst)) + { + return Hand.OFF; + } + + return null; + } + */ + + public static boolean shouldSkipSlotSync(int slotNumber, ItemStack newStack) + { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; ScreenHandler container = player != null ? player.currentScreenHandler : null; - if (player == null) - return false; if (Configs.Generic.SLOT_SYNC_WORKAROUND.getBooleanValue() && - FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue() == false && - container != null && container == player.playerScreenHandler && - (slotNumber == 45 || (slotNumber - 36) == player.getInventory().selectedSlot)) { + FeatureToggle.TWEAK_PICK_BEFORE_PLACE.getBooleanValue() == false && + container != null && container == player.playerScreenHandler && + (slotNumber == 45 || (slotNumber - 36) == player.getInventory().selectedSlot)) + { if (mc.options.useKey.isPressed() && - (Configs.Generic.SLOT_SYNC_WORKAROUND_ALWAYS.getBooleanValue() || - FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() || - FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue())) { + (Configs.Generic.SLOT_SYNC_WORKAROUND_ALWAYS.getBooleanValue() || + FeatureToggle.TWEAK_FAST_BLOCK_PLACEMENT.getBooleanValue() || + FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue())) + { return true; } if (mc.options.attackKey.isPressed() && - FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { + FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) + { return true; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 0bdda5847..d894630e6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -9,17 +9,8 @@ import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.annotation.Nullable; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.Constants; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.malilib.util.InfoUtils; -import fi.dy.masa.tweakeroo.Tweakeroo; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.enchantment.EnchantmentHelper; @@ -53,7 +44,17 @@ import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; -public class InventoryUtils { +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.Constants; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.malilib.util.InfoUtils; +import fi.dy.masa.tweakeroo.Tweakeroo; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; + +public class InventoryUtils +{ private static final List REPAIR_MODE_SLOTS = new ArrayList<>(); private static final List REPAIR_MODE_SLOT_NUMBERS = new ArrayList<>(); private static final HashSet UNSTACKING_ITEMS = new HashSet<>(); @@ -61,118 +62,134 @@ public class InventoryUtils { private static final List TOOL_SWITCH_IGNORED_SLOTS = new ArrayList<>(); private static final HashMap, HashSet> WEAPON_MAPPING = new HashMap<>(); - public static void setToolSwitchableSlots(String configStr) { + public static void setToolSwitchableSlots(String configStr) + { parseSlotsFromString(configStr, TOOL_SWITCHABLE_SLOTS); } - public static void setToolSwitchIgnoreSlots(String configStr) { + public static void setToolSwitchIgnoreSlots(String configStr) + { parseSlotsFromString(configStr, TOOL_SWITCH_IGNORED_SLOTS); } - public static void parseSlotsFromString(String configStr, Collection output) { + public static void parseSlotsFromString(String configStr, Collection output) + { String[] parts = configStr.split(","); Pattern patternRange = Pattern.compile("^(?[0-9])-(?[0-9])$"); output.clear(); - if (configStr.isBlank()) { + if (configStr.isBlank()) + { return; } - for (String str : parts) { - try { + for (String str : parts) + { + try + { Matcher matcher = patternRange.matcher(str); - if (matcher.matches()) { + if (matcher.matches()) + { int slotStart = Integer.parseInt(matcher.group("start")) - 1; int slotEnd = Integer.parseInt(matcher.group("end")) - 1; if (slotStart <= slotEnd && - PlayerInventory.isValidHotbarIndex(slotStart) && - PlayerInventory.isValidHotbarIndex(slotEnd)) { - for (int slotNum = slotStart; slotNum <= slotEnd; ++slotNum) { - if (output.contains(slotNum) == false) { + PlayerInventory.isValidHotbarIndex(slotStart) && + PlayerInventory.isValidHotbarIndex(slotEnd)) + { + for (int slotNum = slotStart; slotNum <= slotEnd; ++slotNum) + { + if (output.contains(slotNum) == false) + { output.add(slotNum); } } } - } else { + } + else + { int slotNum = Integer.parseInt(str) - 1; - if (PlayerInventory.isValidHotbarIndex(slotNum) && output.contains(slotNum) == false) { + if (PlayerInventory.isValidHotbarIndex(slotNum) && output.contains(slotNum) == false) + { output.add(slotNum); } } - } catch (NumberFormatException ignore) { - InfoUtils.showGuiOrInGameMessage(Message.MessageType.ERROR, "Failed to parse slots from string %s", - configStr); + } + catch (NumberFormatException ignore) + { + InfoUtils.showGuiOrInGameMessage(Message.MessageType.ERROR, "Failed to parse slots from string %s", configStr); } } } - public static void setUnstackingItems(List names) { + public static void setUnstackingItems(List names) + { UNSTACKING_ITEMS.clear(); - for (String name : names) { - try { + for (String name : names) + { + try + { Item item = Registries.ITEM.get(new Identifier(name)); - if (item != null && item != Items.AIR) { + if (item != null && item != Items.AIR) + { UNSTACKING_ITEMS.add(item); } - } catch (Exception e) { + } + catch (Exception e) + { Tweakeroo.logger.warn("Failed to set an unstacking protected item from name '{}'", name, e); } } } - public static void setRepairModeSlots(List names) { + public static void setRepairModeSlots(List names) + { REPAIR_MODE_SLOTS.clear(); REPAIR_MODE_SLOT_NUMBERS.clear(); - for (String name : names) { + for (String name : names) + { EquipmentSlot type = null; - switch (name) { - case "mainhand": - type = EquipmentSlot.MAINHAND; - break; - case "offhand": - type = EquipmentSlot.OFFHAND; - break; - case "head": - type = EquipmentSlot.HEAD; - break; - case "chest": - type = EquipmentSlot.CHEST; - break; - case "legs": - type = EquipmentSlot.LEGS; - break; - case "feet": - type = EquipmentSlot.FEET; - break; + switch (name) + { + case "mainhand": type = EquipmentSlot.MAINHAND; break; + case "offhand": type = EquipmentSlot.OFFHAND; break; + case "head": type = EquipmentSlot.HEAD; break; + case "chest": type = EquipmentSlot.CHEST; break; + case "legs": type = EquipmentSlot.LEGS; break; + case "feet": type = EquipmentSlot.FEET; break; } - if (type != null) { + if (type != null) + { REPAIR_MODE_SLOTS.add(type); int slotNum = getSlotNumberForEquipmentType(type, null); - if (slotNum >= 0) { + if (slotNum >= 0) + { REPAIR_MODE_SLOT_NUMBERS.add(slotNum); } } } } - public static void setWeaponMapping(List mappings) { + public static void setWeaponMapping(List mappings) + { WEAPON_MAPPING.clear(); - for (String mapping : mappings) { + for (String mapping : mappings) + { String[] split = mapping.replaceAll(" ", "").split("=>"); - if (split.length != 2) { + if (split.length != 2) + { Tweakeroo.logger.warn("Expected weapon mapping to be `entity_ids => weapon_ids` got '{}'", mapping); continue; } @@ -180,36 +197,46 @@ public static void setWeaponMapping(List mappings) { HashSet weapons = new HashSet<>(); String entities = split[0].trim(); String items = split[1].trim(); - - if (items.equals("") == false) { - for (String itemId : items.split(",")) { - try { + + if (items.equals("") == false) + { + for (String itemId : items.split(",")) + { + try + { Optional weapon = Registries.ITEM.getOrEmpty(new Identifier(itemId)); - if (weapon.isPresent()) { + if (weapon.isPresent()) + { weapons.add(weapon.get()); continue; } - } catch (Exception ignore) { } + catch (Exception ignore) {} Tweakeroo.logger.warn("Unable to find item to use as weapon: '{}'", itemId); } } - if (entities.equalsIgnoreCase("")) { + if (entities.equalsIgnoreCase("")) + { WEAPON_MAPPING.computeIfAbsent(null, s -> new HashSet<>()).addAll(weapons); - } else { - for (String entity_id : entities.split(",")) { - try { + } + else + { + for (String entity_id : entities.split(",")) + { + try + { Optional> entity = Registries.ENTITY_TYPE.getOrEmpty(new Identifier(entity_id)); - if (entity.isPresent()) { + if (entity.isPresent()) + { WEAPON_MAPPING.computeIfAbsent(entity.get(), s -> new HashSet<>()).addAll(weapons); continue; } - } catch (Exception ignore) { } + catch (Exception ignore) {} Tweakeroo.logger.warn("Unable to find entity: '{}'", entity_id); } @@ -217,9 +244,11 @@ public static void setWeaponMapping(List mappings) { } } - private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) { + private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) + { if (REPAIR_MODE_SLOTS.contains(EquipmentSlot.MAINHAND) && - (slotNum - 36) == player.getInventory().selectedSlot) { + (slotNum - 36) == player.getInventory().selectedSlot) + { return true; } @@ -231,23 +260,21 @@ private static boolean isConfiguredRepairSlot(int slotNum, PlayerEntity player) * assuming that the slot number is for the player's main inventory container */ @Nullable - private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity player) { + private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity player) + { if (REPAIR_MODE_SLOTS.contains(EquipmentSlot.MAINHAND) && - (slotNum - 36) == player.getInventory().selectedSlot) { + (slotNum - 36) == player.getInventory().selectedSlot) + { return EquipmentSlot.MAINHAND; } - switch (slotNum) { - case 45: - return EquipmentSlot.OFFHAND; - case 5: - return EquipmentSlot.HEAD; - case 6: - return EquipmentSlot.CHEST; - case 7: - return EquipmentSlot.LEGS; - case 8: - return EquipmentSlot.FEET; + switch (slotNum) + { + case 45: return EquipmentSlot.OFFHAND; + case 5: return EquipmentSlot.HEAD; + case 6: return EquipmentSlot.CHEST; + case 7: return EquipmentSlot.LEGS; + case 8: return EquipmentSlot.FEET; } return null; @@ -257,79 +284,85 @@ private static EquipmentSlot getEquipmentTypeForSlot(int slotNum, PlayerEntity p * Returns the slot number for the given equipment type * in the player's inventory container */ - private static int getSlotNumberForEquipmentType(EquipmentSlot type, @Nullable PlayerEntity player) { - switch (type) { - case MAINHAND: - return player != null ? player.getInventory().selectedSlot + 36 : -1; - case OFFHAND: - return 45; - case HEAD: - return 5; - case CHEST: - return 6; - case LEGS: - return 7; - case FEET: - return 8; + private static int getSlotNumberForEquipmentType(EquipmentSlot type, @Nullable PlayerEntity player) + { + switch (type) + { + case MAINHAND: return player != null ? player.getInventory().selectedSlot + 36 : -1; + case OFFHAND: return 45; + case HEAD: return 5; + case CHEST: return 6; + case LEGS: return 7; + case FEET: return 8; } return -1; } - public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) { + public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) + { ScreenHandler container = player.playerScreenHandler; row = MathHelper.clamp(row, 0, 2); int slot = row * 9 + 9; - for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) { + for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) + { fi.dy.masa.malilib.util.InventoryUtils.swapSlots(container, slot, hotbarSlot); slot++; } } - public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemStack stackReference, - boolean allowHotbar) { + public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemStack stackReference, boolean allowHotbar) + { int slotWithItem; - if (stackReference.getItem().isDamageable()) { + if (stackReference.getItem().isDamageable()) + { int minDurability = getMinDurability(stackReference); - slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(player.playerScreenHandler, - stackReference, minDurability); - } else { + slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(player.playerScreenHandler, stackReference, minDurability); + } + else + { slotWithItem = findSlotWithItem(player.playerScreenHandler, stackReference, allowHotbar, true); } - if (slotWithItem != -1) { + if (slotWithItem != -1) + { swapItemToHand(player, hand, slotWithItem); } } - public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowHotbar) { + public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowHotbar) + { ItemStack stackHand = player.getStackInHand(hand); int threshold = Configs.Generic.HAND_RESTOCK_PRE_THRESHOLD.getIntegerValue(); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - Configs.Generic.HAND_RESTOCK_PRE.getBooleanValue() && - stackHand.isEmpty() == false && - stackHand.getCount() <= threshold && stackHand.getMaxCount() > threshold && - PlacementTweaks.canUseItemWithRestriction(PlacementTweaks.HAND_RESTOCK_RESTRICTION, stackHand) && - player.currentScreenHandler == player.playerScreenHandler && - player.currentScreenHandler.getCursorStack().isEmpty()) { + Configs.Generic.HAND_RESTOCK_PRE.getBooleanValue() && + stackHand.isEmpty() == false && + stackHand.getCount() <= threshold && stackHand.getMaxCount() > threshold && + PlacementTweaks.canUseItemWithRestriction(PlacementTweaks.HAND_RESTOCK_RESTRICTION, stackHand) && + player.currentScreenHandler == player.playerScreenHandler && + player.currentScreenHandler.getCursorStack().isEmpty()) + { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.playerScreenHandler; int endSlot = allowHotbar ? 44 : 35; int currentMainHandSlot = player.getInventory().selectedSlot + 36; int currentSlot = hand == Hand.MAIN_HAND ? currentMainHandSlot : 45; - for (int slotNum = 9; slotNum <= endSlot; ++slotNum) { - if (slotNum == currentMainHandSlot) { + for (int slotNum = 9; slotNum <= endSlot; ++slotNum) + { + if (slotNum == currentMainHandSlot) + { continue; } Slot slot = container.slots.get(slotNum); ItemStack stackSlot = slot.getStack(); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(stackSlot, stackHand)) { + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(stackSlot, stackHand)) + { // If all the items from the found slot can fit into the current // stack in hand, then left click, otherwise right click to split the stack int button = stackSlot.getCount() + stackHand.getCount() <= stackHand.getMaxCount() ? 0 : 1; @@ -343,159 +376,188 @@ public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowH } } - public static void trySwapCurrentToolIfNearlyBroken() { + public static void trySwapCurrentToolIfNearlyBroken() + { PlayerEntity player = MinecraftClient.getInstance().player; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() && player != null) { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() && player != null) + { trySwapCurrentToolIfNearlyBroken(Hand.MAIN_HAND, player); trySwapCurrentToolIfNearlyBroken(Hand.OFF_HAND, player); } } - public static void trySwapCurrentToolIfNearlyBroken(Hand hand, PlayerEntity player) { + public static void trySwapCurrentToolIfNearlyBroken(Hand hand, PlayerEntity player) + { ItemStack stack = player.getStackInHand(hand); - if (stack.isEmpty() == false) { + if (stack.isEmpty() == false) + { int minDurability = getMinDurability(stack); - if (isItemAtLowDurability(stack, minDurability)) { + if (isItemAtLowDurability(stack, minDurability)) + { swapItemWithHigherDurabilityToHand(player, hand, stack, minDurability + 1); } } } - public static void trySwitchToWeapon(Entity entity) { + public static void trySwitchToWeapon(Entity entity) + { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; if (player != null && mc.world != null && - TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) { + TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) + { ScreenHandler container = player.playerScreenHandler; ItemPickerTest test; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) { - test = (currentStack, previous) -> InventoryUtils.isBetterWeaponAndHasDurability(currentStack, previous, - entity); - } else { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) + { + test = (currentStack, previous) -> InventoryUtils.isBetterWeaponAndHasDurability(currentStack, previous, entity); + } + else + { test = (currentStack, previous) -> InventoryUtils.isBetterWeapon(currentStack, previous, entity); } - int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), - UniformIntProvider.create(9, 35)); + int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), UniformIntProvider.create(9, 35)); - if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) { + if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) + { swapToolToHand(slotNumber, mc); PlacementTweaks.cacheStackInHand(Hand.MAIN_HAND); } } } - private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) { - return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) - && (makesMoreDamage(testedStack, previousWeapon) - || matchesWeaponMapping(previousWeapon, entity) == false); + private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) + { + return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) && (makesMoreDamage(testedStack, previousWeapon) || matchesWeaponMapping(previousWeapon, entity) == false); } - private static boolean isBetterWeaponAndHasDurability(ItemStack testedStack, ItemStack previousTool, - Entity entity) { + private static boolean isBetterWeaponAndHasDurability(ItemStack testedStack, ItemStack previousTool, Entity entity) + { return hasEnoughDurability(testedStack) && isBetterWeapon(testedStack, previousTool, entity); } - private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previousTool) { + private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previousTool) + { return getBaseAttackDamage(testedStack) > getBaseAttackDamage(previousTool); } - private static float getBaseAttackDamage(ItemStack stack) { + private static float getBaseAttackDamage(ItemStack stack) + { Item item = stack.getItem(); - if (item instanceof SwordItem) { + if (item instanceof SwordItem) + { return ((SwordItem) item).getAttackDamage(); - } else if (item instanceof MiningToolItem) { + } + else if (item instanceof MiningToolItem) + { return ((MiningToolItem) item).getAttackDamage(); } return 0F; } - protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) { + protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) + { HashSet weapons = WEAPON_MAPPING.getOrDefault(entity.getType(), WEAPON_MAPPING.get(null)); return weapons != null && weapons.contains(stack.getItem()); } - public static void trySwitchToEffectiveTool(BlockPos pos) { + public static void trySwitchToEffectiveTool(BlockPos pos) + { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; if (player != null && mc.world != null && - TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) { + TOOL_SWITCH_IGNORED_SLOTS.contains(player.getInventory().selectedSlot) == false) + { BlockState state = mc.world.getBlockState(pos); ScreenHandler container = player.playerScreenHandler; ItemPickerTest test; - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) { - test = (currentStack, previous) -> InventoryUtils.isBetterToolAndHasDurability(currentStack, previous, - state); - } else { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue()) + { + test = (currentStack, previous) -> InventoryUtils.isBetterToolAndHasDurability(currentStack, previous, state); + } + else + { test = (currentStack, previous) -> InventoryUtils.isBetterTool(currentStack, previous, state); } - int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), - UniformIntProvider.create(9, 35)); + int slotNumber = findSlotWithBestItemMatch(container, test, UniformIntProvider.create(36, 44), UniformIntProvider.create(9, 35)); - if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) { + if (slotNumber != -1 && (slotNumber - 36) != player.getInventory().selectedSlot) + { swapToolToHand(slotNumber, mc); } } } - private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { + private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) + { return testedStack.isEmpty() == false && isMoreEffectiveTool(testedStack, previousTool, state); } - private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemStack previousTool, - BlockState state) { + private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemStack previousTool, BlockState state) + { return hasEnoughDurability(testedStack) && isBetterTool(testedStack, previousTool, state); } - private static boolean isMoreEffectiveTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { + private static boolean isMoreEffectiveTool(ItemStack testedStack, ItemStack previousTool, BlockState state) + { return getBaseBlockBreakingSpeed(testedStack, state) > getBaseBlockBreakingSpeed(previousTool, state); } - protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState state) { + protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState state) + { float speed = stack.getMiningSpeedMultiplier(state); - if (speed > 1.0f) { + if (speed > 1.0f) + { int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); - if (effLevel > 0) { + if (effLevel > 0) + { speed += (effLevel * effLevel) + 1; } } - if (state.isToolRequired() && stack.isSuitableFor(state) == false) { + if (state.isToolRequired() && stack.isSuitableFor(state) == false) + { speed /= (100F / 30F); } return speed; } - protected static boolean hasEnoughDurability(ItemStack stack) { + protected static boolean hasEnoughDurability(ItemStack stack) + { return stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack); } - private static int findSuitableSlot(ScreenHandler container, Predicate itemTest) { + private static int findSuitableSlot(ScreenHandler container, Predicate itemTest) + { return findSuitableSlot(container, itemTest, UniformIntProvider.create(9, container.slots.size() - 1)); } - private static int findSuitableSlot(ScreenHandler container, Predicate itemTest, - UniformIntProvider... ranges) { + private static int findSuitableSlot(ScreenHandler container, Predicate itemTest, UniformIntProvider... ranges) + { final int max = container.slots.size() - 1; - for (UniformIntProvider range : ranges) { + for (UniformIntProvider range : ranges) + { int end = Math.min(max, range.getMax()); - for (int slotNumber = range.getMin(); slotNumber <= end; ++slotNumber) { - if (itemTest.test(container.getSlot(slotNumber).getStack())) { + for (int slotNumber = range.getMin(); slotNumber <= end; ++slotNumber) + { + if (itemTest.test(container.getSlot(slotNumber).getStack())) + { return slotNumber; } } @@ -504,19 +566,22 @@ private static int findSuitableSlot(ScreenHandler container, Predicate slotNumbers) { + private static int findEmptySlot(ScreenHandler container, Collection slotNumbers) + { final int maxSlot = container.slots.size() - 1; - for (int slotNumber : slotNumbers) { + for (int slotNumber : slotNumbers) + { if (slotNumber >= 0 && slotNumber <= maxSlot && - container.getSlot(slotNumber).hasStack() == false) { + container.getSlot(slotNumber).hasStack() == false) + { return slotNumber; } } @@ -539,16 +607,20 @@ private static int findEmptySlot(ScreenHandler container, Collection sl return -1; } - public interface ItemPickerTest { + public interface ItemPickerTest + { boolean isBetterMatch(ItemStack testedStack, ItemStack previousBestMatch); } - private static boolean isItemAtLowDurability(ItemStack stack, int minDurability) { + private static boolean isItemAtLowDurability(ItemStack stack, int minDurability) + { return stack.isDamageable() && (stack.getMaxDamage() - stack.getDamage()) <= minDurability; } - private static int getMinDurability(ItemStack stack) { - if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() == false) { + private static int getMinDurability(ItemStack stack) + { + if (FeatureToggle.TWEAK_SWAP_ALMOST_BROKEN_TOOLS.getBooleanValue() == false) + { return 0; } @@ -557,20 +629,21 @@ private static int getMinDurability(ItemStack stack) { // For items with low maximum durability, use 8% as the threshold, // if the configured durability threshold is over that. if (stack.getMaxDamage() <= 100 && minDurability <= 20 && - (double) minDurability / (double) stack.getMaxDamage() > 0.08) { + (double) minDurability / (double) stack.getMaxDamage() > 0.08) + { minDurability = (int) Math.ceil(stack.getMaxDamage() * 0.08); } return minDurability; } - private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand hand, ItemStack stackReference, - int minDurabilityLeft) { + private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand hand, ItemStack stackReference, int minDurabilityLeft) + { ScreenHandler container = player.playerScreenHandler; - int slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(container, stackReference, - minDurabilityLeft); + int slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(container, stackReference, minDurabilityLeft); - if (slotWithItem != -1) { + if (slotWithItem != -1) + { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_for_better_durability"); return; @@ -578,7 +651,8 @@ private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand slotWithItem = fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(container, false, false); - if (slotWithItem != -1) { + if (slotWithItem != -1) + { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_off_players_hand"); return; @@ -586,55 +660,66 @@ private static void swapItemWithHigherDurabilityToHand(PlayerEntity player, Hand slotWithItem = findSuitableSlot(container, (s) -> s.isDamageable() == false); - if (slotWithItem != -1) { + if (slotWithItem != -1) + { swapItemToHand(player, hand, slotWithItem); InfoUtils.printActionbarMessage("tweakeroo.message.swapped_low_durability_item_for_dummy_item"); } } - public static void repairModeSwapItems(PlayerEntity player) { - if (player.currentScreenHandler == player.playerScreenHandler) { - for (EquipmentSlot type : REPAIR_MODE_SLOTS) { + public static void repairModeSwapItems(PlayerEntity player) + { + if (player.currentScreenHandler == player.playerScreenHandler) + { + for (EquipmentSlot type : REPAIR_MODE_SLOTS) + { repairModeHandleSlot(player, type); } } } - private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type) { + private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type) + { int slotNum = getSlotNumberForEquipmentType(type, player); - if (slotNum == -1) { + if (slotNum == -1) + { return; } ItemStack stack = player.getEquippedStack(type); if (stack.isEmpty() == false && - (stack.isDamageable() == false || - stack.isDamaged() == false || - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) <= 0)) { + (stack.isDamageable() == false || + stack.isDamaged() == false || + EnchantmentHelper.getLevel(Enchantments.MENDING, stack) <= 0)) + { Slot slot = player.currentScreenHandler.getSlot(slotNum); int slotRepairableItem = findRepairableItemNotInRepairableSlot(slot, player); - if (slotRepairableItem != -1) { + if (slotRepairableItem != -1) + { swapItemToEquipmentSlot(player, type, slotRepairableItem); - InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", - type.getName()); + InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", type.getName()); } } } - private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player) { + private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player) + { ScreenHandler containerPlayer = player.currentScreenHandler; - for (Slot slot : containerPlayer.slots) { - if (slot.hasStack() && isConfiguredRepairSlot(slot.id, player) == false) { + for (Slot slot : containerPlayer.slots) + { + if (slot.hasStack() && isConfiguredRepairSlot(slot.id, player) == false) + { ItemStack stack = slot.getStack(); // Don't take items from the current hotbar slot if ((slot.id - 36) != player.getInventory().selectedSlot && - stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) > 0) { + stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && + EnchantmentHelper.getLevel(Enchantments.MENDING, stack) > 0) + { return slot.id; } } @@ -643,55 +728,51 @@ private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, Player return -1; } - public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) { - if (player == null || GuiUtils.getCurrentScreen() != null) { + public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) + { + if (player == null || GuiUtils.getCurrentScreen() != null) + { return; } ScreenHandler container = player.currentScreenHandler; ItemStack currentStack = player.getEquippedStack(EquipmentSlot.CHEST); - Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem - && ((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; + Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem && ((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; Predicate stackFilterElytra = (s) -> s.getItem() instanceof ElytraItem && ElytraItem.isUsable(s); - Predicate stackFilter = (currentStack.isEmpty() || stackFilterChestPlate.test(currentStack)) - ? stackFilterElytra - : stackFilterChestPlate; - Predicate finalFilter = (s) -> s.isEmpty() == false && stackFilter.test(s) - && s.getDamage() < s.getMaxDamage() - 10; + Predicate stackFilter = (currentStack.isEmpty() || stackFilterChestPlate.test(currentStack)) ? stackFilterElytra : stackFilterChestPlate; + Predicate finalFilter = (s) -> s.isEmpty() == false && stackFilter.test(s) && s.getDamage() < s.getMaxDamage() - 10; int targetSlot = findSuitableSlot(container, finalFilter); - if (targetSlot >= 0) { - // targetSlots.sort(); + if (targetSlot >= 0) + { + //targetSlots.sort(); swapItemToEquipmentSlot(player, EquipmentSlot.CHEST, targetSlot); } } /** * - * Finds a slot with an identical item than stackReference, ignoring the - * durability - * of damageable items. Does not allow crafting or armor slots or the offhand - * slot + * Finds a slot with an identical item than stackReference, ignoring the durability + * of damageable items. Does not allow crafting or armor slots or the offhand slot * in the ContainerPlayer container. - * * @return the slot number, or -1 if none were found */ - public static int findSlotWithItem(ScreenHandler container, ItemStack stackReference, boolean allowHotbar, - boolean reverse) { + public static int findSlotWithItem(ScreenHandler container, ItemStack stackReference, boolean allowHotbar, boolean reverse) + { final int startSlot = reverse ? container.slots.size() - 1 : 0; final int endSlot = reverse ? -1 : container.slots.size(); final int increment = reverse ? -1 : 1; final boolean isPlayerInv = container instanceof PlayerScreenHandler; - for (int slotNum = startSlot; slotNum != endSlot; slotNum += increment) { + for (int slotNum = startSlot; slotNum != endSlot; slotNum += increment) + { Slot slot = container.slots.get(slotNum); - if ((isPlayerInv == false || fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false)) - && - (allowHotbar || isHotbarSlot(slot) == false) && - fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(slot.getStack(), - stackReference)) { + if ((isPlayerInv == false || fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false)) && + (allowHotbar || isHotbarSlot(slot) == false) && + fi.dy.masa.malilib.util.InventoryUtils.areStacksEqualIgnoreDurability(slot.getStack(), stackReference)) + { return slot.id; } } @@ -699,105 +780,129 @@ public static int findSlotWithItem(ScreenHandler container, ItemStack stackRefer return -1; } - private static boolean isHotbarSlot(Slot slot) { + private static boolean isHotbarSlot(Slot slot) + { return isHotbarSlot(slot.id); } - private static boolean isHotbarSlot(int slot) { + private static boolean isHotbarSlot(int slot) + { return slot >= 36 && slot < (36 + PlayerInventory.getHotbarSize()); } - private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumber) { + private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumber) + { ScreenHandler container = player.currentScreenHandler; - if (slotNumber != -1 && container == player.playerScreenHandler) { + if (slotNumber != -1 && container == player.playerScreenHandler) + { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inventory = player.getInventory(); - if (hand == Hand.MAIN_HAND) { + if (hand == Hand.MAIN_HAND) + { int currentHotbarSlot = inventory.selectedSlot; - if (isHotbarSlot(slotNumber)) { + if (isHotbarSlot(slotNumber)) + { inventory.selectedSlot = slotNumber - 36; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); - } else { - mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, - SlotActionType.SWAP, mc.player); } - } else if (hand == Hand.OFF_HAND) { + else + { + mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player); + } + } + else if (hand == Hand.OFF_HAND) + { mc.interactionManager.clickSlot(container.syncId, slotNumber, 40, SlotActionType.SWAP, mc.player); } } } - private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot type, int sourceSlotNumber) { - if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) { + + private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot type, int sourceSlotNumber) + { + if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) + { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.playerScreenHandler; int equipmentSlotNumber = getSlotNumberForEquipmentType(type, player); int equipmentSlotInvIndex = container.getSlot(equipmentSlotNumber).getIndex(); - mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, - SlotActionType.SWAP, mc.player); + mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, SlotActionType.SWAP, mc.player); } } - private static void swapToolToHand(int slotNumber, MinecraftClient mc) { + private static void swapToolToHand(int slotNumber, MinecraftClient mc) + { PlayerEntity player = mc.player; - if (slotNumber >= 0 && player.currentScreenHandler == player.playerScreenHandler) { + if (slotNumber >= 0 && player.currentScreenHandler == player.playerScreenHandler) + { PlayerInventory inventory = player.getInventory(); ScreenHandler container = player.playerScreenHandler; - if (isHotbarSlot(slotNumber)) { + if (isHotbarSlot(slotNumber)) + { inventory.selectedSlot = slotNumber - 36; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); - } else { + } + else + { int selectedSlot = inventory.selectedSlot; int hotbarSlot = getUsableHotbarSlotForTool(selectedSlot, TOOL_SWITCHABLE_SLOTS, container); - if (PlayerInventory.isValidHotbarIndex(hotbarSlot)) { - if (hotbarSlot != selectedSlot) { + if (PlayerInventory.isValidHotbarIndex(hotbarSlot)) + { + if (hotbarSlot != selectedSlot) + { inventory.selectedSlot = hotbarSlot; mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } - mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, - mc.player); + mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); } } } } - private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection validSlots, - ScreenHandler container) { + private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection validSlots, ScreenHandler container) + { int first = -1; int nonTool = -1; - if (validSlots.contains(currentHotbarSlot)) { + if (validSlots.contains(currentHotbarSlot)) + { ItemStack stack = container.getSlot(currentHotbarSlot + 36).getStack(); - if (stack.isEmpty()) { + if (stack.isEmpty()) + { return currentHotbarSlot; } - if ((stack.getItem() instanceof ToolItem) == false) { + if ((stack.getItem() instanceof ToolItem) == false) + { nonTool = currentHotbarSlot; } } - for (int hotbarSlot : validSlots) { + for (int hotbarSlot : validSlots) + { ItemStack stack = container.getSlot(hotbarSlot + 36).getStack(); - if (stack.isEmpty()) { + if (stack.isEmpty()) + { return hotbarSlot; } - if (nonTool == -1 && (stack.getItem() instanceof ToolItem) == false) { + if (nonTool == -1 && (stack.getItem() instanceof ToolItem) == false) + { nonTool = hotbarSlot; } - if (first == -1) { + if (first == -1) + { first = hotbarSlot; } } @@ -805,16 +910,18 @@ private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection< return nonTool >= 0 ? nonTool : first; } - private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenHandler container, - ItemStack stackReference, int minDurabilityLeft) { - for (Slot slot : container.slots) { + private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenHandler container, ItemStack stackReference, int minDurabilityLeft) + { + for (Slot slot : container.slots) + { ItemStack stackSlot = slot.getStack(); // Only accept regular inventory slots (no crafting, armor slots, or offhand) if (fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false) && - ItemStack.areItemsEqual(stackSlot, stackReference) && - stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && - hasSameIshEnchantments(stackReference, stackSlot)) { + ItemStack.areItemsEqual(stackSlot, stackReference) && + stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && + hasSameIshEnchantments(stackReference, stackSlot)) + { return slot.id; } } @@ -822,46 +929,56 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH return -1; } - private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) { + private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) + { int level = EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stackReference); - if (level > 0) { + if (level > 0) + { return EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) >= level; } level = EnchantmentHelper.getLevel(Enchantments.FORTUNE, stackReference); - if (level > 0) { + if (level > 0) + { return EnchantmentHelper.getLevel(Enchantments.FORTUNE, stack) >= level; } return true; } - private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) { + private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) + { int slotNum = -1; float bestSpeed = -1f; - for (Slot slot : container.slots) { + for (Slot slot : container.slots) + { // Don't consider armor and crafting slots - if (slot.id <= 8 || slot.hasStack() == false) { + if (slot.id <= 8 || slot.hasStack() == false) + { continue; } ItemStack stack = slot.getStack(); - if (stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack)) { + if (stack.getMaxDamage() - stack.getDamage() > getMinDurability(stack)) + { float speed = stack.getMiningSpeedMultiplier(state); - if (speed > 1.0f) { + if (speed > 1.0f) + { int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); - if (effLevel > 0) { + if (effLevel > 0) + { speed += (effLevel * effLevel) + 1; } } - if (speed > 1f && (slotNum == -1 || speed > bestSpeed)) { + if (speed > 1f && (slotNum == -1 || speed > bestSpeed)) + { slotNum = slot.id; bestSpeed = speed; } @@ -871,114 +988,131 @@ private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler con return slotNum; } - private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack stackReference) { + private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack stackReference) + { List slots = new ArrayList<>(); ScreenHandler container = player.playerScreenHandler; MinecraftClient mc = MinecraftClient.getInstance(); - for (Slot slot : container.slots) { + for (Slot slot : container.slots) + { // Inventory crafting and armor slots are not valid - if (slot.id < 8) { + if (slot.id < 8) + { continue; } ItemStack stack = slot.getStack(); - if (stack.getCount() < stack.getMaxCount() - && fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackReference, stack)) { + if (stack.getCount() < stack.getMaxCount() && fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackReference, stack)) + { slots.add(slot); } } - for (int i = 0; i < slots.size(); ++i) { + for (int i = 0; i < slots.size(); ++i) + { Slot slot1 = slots.get(i); - for (int j = i + 1; j < slots.size(); ++j) { + for (int j = i + 1; j < slots.size(); ++j) + { Slot slot2 = slots.get(j); ItemStack stack = slot1.getStack(); - if (stack.getCount() < stack.getMaxCount()) { + if (stack.getCount() < stack.getMaxCount()) + { // Pick up the item from slot1 and try to put it in slot2 mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest - if (player.getInventory().getMainHandStack().isEmpty() == false) { + if (player.getInventory().getMainHandStack().isEmpty() == false) + { mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } - if (slot2.getStack().getCount() >= slot2.getStack().getMaxCount()) { + if (slot2.getStack().getCount() >= slot2.getStack().getMaxCount()) + { slots.remove(j); --j; } } - if (slot1.hasStack() == false) { + if (slot1.hasStack() == false) + { break; } } } } - public static boolean canUnstackingItemNotFitInInventory(ItemStack stack, PlayerEntity player) { + public static boolean canUnstackingItemNotFitInInventory(ItemStack stack, PlayerEntity player) + { if (FeatureToggle.TWEAK_ITEM_UNSTACKING_PROTECTION.getBooleanValue() && - stack.getCount() > 1 && - UNSTACKING_ITEMS.contains(stack.getItem())) { - if (fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, - false) == -1) { + stack.getCount() > 1 && + UNSTACKING_ITEMS.contains(stack.getItem())) + { + if (fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, false) == -1) + { tryCombineStacksInInventory(player, stack); - return fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, - false, false) == -1; + return fi.dy.masa.malilib.util.InventoryUtils.findEmptySlotInPlayerInventory(player.playerScreenHandler, false, false) == -1; } } return false; } - public static void switchToPickedBlock() { - MinecraftClient mc = MinecraftClient.getInstance(); + public static void switchToPickedBlock() + { + MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; World world = mc.world; - if (player == null || world == null || player.currentScreenHandler != player.playerScreenHandler) { + if (player == null || world == null || player.currentScreenHandler != player.playerScreenHandler) + { return; } - double reach = mc.player.getBlockInteractionRange(); + double reach = mc.interactionManager.getReachDistance(); boolean isCreative = player.isCreative(); HitResult trace = player.raycast(reach, mc.getTickDelta(), false); - if (trace != null && trace.getType() == HitResult.Type.BLOCK) { + if (trace != null && trace.getType() == HitResult.Type.BLOCK) + { BlockPos pos = ((BlockHitResult) trace).getBlockPos(); BlockState stateTargeted = world.getBlockState(pos); ItemStack stack = stateTargeted.getBlock().getPickStack(world, pos, stateTargeted); if (stack.isEmpty() == false && - fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) { + fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) + { ScreenHandler container = player.currentScreenHandler; PlayerInventory inventory = player.getInventory(); /* - * if (isCreative) - * { - * TileEntity te = world.getTileEntity(pos); - * - * if (te != null) - * { - * mc.storeTEInStack(stack, te); - * } - * } - */ - - if (isCreative) { + if (isCreative) + { + TileEntity te = world.getTileEntity(pos); + + if (te != null) + { + mc.storeTEInStack(stack, te); + } + } + */ + + if (isCreative) + { inventory.addPickBlock(stack); - mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), - 36 + inventory.selectedSlot); - } else { - // player.getInventory().getSlotFor(stack); + mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); + } + else + { + //player.getInventory().getSlotFor(stack); int slotNumber = fi.dy.masa.malilib.util.InventoryUtils.findSlotWithItem(container, stack, true); - if (slotNumber != -1) { + if (slotNumber != -1) + { swapItemToHand(player, Hand.MAIN_HAND, slotNumber); } } @@ -986,26 +1120,32 @@ public static void switchToPickedBlock() { } } - public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { + public static boolean cleanUpShulkerBoxNBT(ItemStack stack) + { boolean changed = false; NbtCompound nbt = stack.getNbt(); - if (nbt != null) { - if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) { + if (nbt != null) + { + if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) + { NbtCompound tag = nbt.getCompound("BlockEntityTag"); if (tag.contains("Items", Constants.NBT.TAG_LIST) && - tag.getList("Items", Constants.NBT.TAG_COMPOUND).size() == 0) { + tag.getList("Items", Constants.NBT.TAG_COMPOUND).size() == 0) + { tag.remove("Items"); changed = true; } - if (tag.isEmpty()) { + if (tag.isEmpty()) + { nbt.remove("BlockEntityTag"); } } - if (nbt.isEmpty()) { + if (nbt.isEmpty()) + { stack.setNbt(null); changed = true; } From fe17c3450e2d164939e8cb73acf4e17be1443c6b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:05:20 -0500 Subject: [PATCH 004/128] IntelliJ Changes --- .gitignore | 1 + .../java/fi/dy/masa/tweakeroo/config/Configs.java | 1 + .../fi/dy/masa/tweakeroo/config/FeatureToggle.java | 1 + .../mixin/MixinClientPlayerInteractionManager.java | 4 ++-- .../fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java | 12 +++++++----- .../dy/masa/tweakeroo/mixin/MixinPlayerEntity.java | 8 ++++---- .../java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java | 4 ++-- .../fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java | 2 +- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 2 +- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 7ef5b896e..0dd9d3a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ build.number run .vscode libs/ +.idea/ diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 9f01acd65..bd665ef57 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -246,6 +246,7 @@ public static class Generic { AFTER_CLICKER_CLICK_COUNT, BLOCK_REACH_DISTANCE, + ENTITY_REACH_DISTANCE, BREAKING_GRID_SIZE, CUSTOM_INVENTORY_GUI_SCALE, FAST_BLOCK_PLACEMENT_COUNT, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 6de4ed80a..5211bbbba 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -23,6 +23,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable blockReachDistance"), + TWEAK_ENTITY_REACH_OVERRIDE ("tweakEntityReachOverride", false, "", "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), TWEAK_BREAKING_RESTRICTION ("tweakBreakingRestriction", false, "", "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 4b970e296..12885a5fb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -21,7 +21,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.tweaks.MiscTweaks; import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; @@ -160,6 +159,7 @@ private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackIn } } +/* @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) private void overrideReachDistance(CallbackInfoReturnable cir) { @@ -177,7 +177,7 @@ private void overrideExtendedReach(CallbackInfoReturnable cir) cir.setReturnValue(false); } } - +*/ @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index d272f3a88..243078bff 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -26,7 +26,7 @@ public abstract class MixinInGameHud { @Shadow @Final private PlayerListHud playerListHud; @Shadow @Final private MinecraftClient client; - @Shadow private int scaledWidth; + //@Shadow private int scaledWidth; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) private void overridePlayerForRendering(CallbackInfoReturnable cir) @@ -49,10 +49,10 @@ private void overrideCursorRender(CallbackInfo ci) } } - @Inject(method = "render", + @Inject(method = "renderPlayerList", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", - ordinal = 1, shift = At.Shift.AFTER)) + target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", + ordinal = 1, shift = At.Shift.AFTER)) private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) { if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) @@ -61,7 +61,9 @@ private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, Ca ScoreboardObjective objective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.LIST); this.playerListHud.setVisible(true); - this.playerListHud.render(drawContext, this.scaledWidth, scoreboard, objective); + this.playerListHud.render(drawContext, drawContext.getScaledWindowWidth(), scoreboard, objective); + + ci.cancel(); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 2ed9955c2..0c0a929a1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -41,16 +41,16 @@ private boolean fakeSneaking(PlayerEntity entity) { } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideBlockReachDistance(CallbackInfoReturnable cir) { + private void overrideBlockReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideEntityReachDistance(CallbackInfoReturnable cir) { + private void overrideEntityReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue((float) Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index f71c109e6..c8f13a822 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -249,10 +249,10 @@ else if (messageOutputType == MessageOutputType.ACTIONBAR) private static boolean potionWarningShouldInclude(StatusEffectInstance effect) { return effect.isAmbient() == false && - (effect.getEffectType().isBeneficial() || + (effect.getEffectType().value().isBeneficial() || Configs.Generic.POTION_WARNING_BENEFICIAL_ONLY.getBooleanValue() == false) && effect.getDuration() <= Configs.Generic.POTION_WARNING_THRESHOLD.getIntegerValue() && - POTION_RESTRICTION.isAllowed(effect.getEffectType()); + POTION_RESTRICTION.isAllowed(effect.getEffectType().value()); } @Nullable diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 0cc87f61a..2b4633b94 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -225,7 +225,7 @@ private static void onUsingTick() { ClientPlayerEntity player = mc.player; World world = player.getEntityWorld(); - final double reach = mc.interactionManager.getReachDistance(); + final double reach = mc.player.getBlockInteractionRange(); final int maxCount = Configs.Generic.FAST_BLOCK_PLACEMENT_COUNT.getIntegerValue(); mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d894630e6..2ed07a2dd 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1074,7 +1074,7 @@ public static void switchToPickedBlock() return; } - double reach = mc.interactionManager.getReachDistance(); + double reach = mc.player.getBlockInteractionRange(); boolean isCreative = player.isCreative(); HitResult trace = player.raycast(reach, mc.getTickDelta(), false); From 19613e1a11a1123f047358f9d7cfb2bcdc3a6856 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 19:55:45 -0500 Subject: [PATCH 005/128] IntelliJ Changes --- .../MixinClientPlayerInteractionManager.java | 19 ----------- .../masa/tweakeroo/mixin/MixinInGameHud.java | 1 - .../tweakeroo/mixin/MixinPlayerEntity.java | 34 ++++++++++++------- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 12885a5fb..937f3a4e9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -159,25 +159,6 @@ private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackIn } } -/* - @Inject(method = "getReachDistance", at = @At("HEAD"), cancellable = true) - private void overrideReachDistance(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - { - cir.setReturnValue((float) Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); - } - } - - @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) - private void overrideExtendedReach(CallbackInfoReturnable cir) - { - if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) - { - cir.setReturnValue(false); - } - } -*/ @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index 243078bff..a56f17b82 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -26,7 +26,6 @@ public abstract class MixinInGameHud { @Shadow @Final private PlayerListHud playerListHud; @Shadow @Final private MinecraftClient client; - //@Shadow private int scaledWidth; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) private void overridePlayerForRendering(CallbackInfoReturnable cir) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 0c0a929a1..77eb643cf 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -7,33 +7,39 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; @Mixin(PlayerEntity.class) -public abstract class MixinPlayerEntity extends LivingEntity { +public abstract class MixinPlayerEntity extends LivingEntity +{ @Shadow protected abstract boolean clipAtLedge(); - protected MixinPlayerEntity(EntityType entityType_1, World world_1) { + protected MixinPlayerEntity(EntityType entityType_1, World world_1) + { super(entityType_1, world_1); } @Inject(method = "method_30263", at = @At("HEAD"), cancellable = true) - private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) { - if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) { + private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) + { cir.setReturnValue(this.isOnGround()); } } @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) - private boolean fakeSneaking(PlayerEntity entity) { - if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) { + private boolean fakeSneaking(PlayerEntity entity) + { + if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) + { return true; } @@ -41,15 +47,19 @@ private boolean fakeSneaking(PlayerEntity entity) { } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideBlockReachDistance(CallbackInfoReturnable cir) { - if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { + private void overrideBlockReachDistance(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) + { cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideEntityReachDistance(CallbackInfoReturnable cir) { - if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { + private void overrideEntityReachDistance(CallbackInfoReturnable cir) + { + if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) + { cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } } From a8ef9f524be39dc3c9436098f0bd35491fc86951 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 19:59:50 -0500 Subject: [PATCH 006/128] IntelliJ Changes --- .../java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 77eb643cf..c4334c99b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -18,8 +18,7 @@ @Mixin(PlayerEntity.class) public abstract class MixinPlayerEntity extends LivingEntity { - @Shadow - protected abstract boolean clipAtLedge(); + @Shadow protected abstract boolean clipAtLedge(); protected MixinPlayerEntity(EntityType entityType_1, World world_1) { @@ -35,7 +34,8 @@ private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) } } - @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) + @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", + target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) private boolean fakeSneaking(PlayerEntity entity) { if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) From b378cdd406663da17a8d8c0637d4d6f88a00167b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:02:16 -0500 Subject: [PATCH 007/128] IntelliJ Changes --- .../java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index a56f17b82..fe6131139 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -38,7 +38,8 @@ private void overridePlayerForRendering(CallbackInfoReturnable cir } @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) + target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", + ordinal = 0), cancellable = true) private void overrideCursorRender(CallbackInfo ci) { if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) @@ -61,12 +62,10 @@ private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, Ca this.playerListHud.setVisible(true); this.playerListHud.render(drawContext, drawContext.getScaledWindowWidth(), scoreboard, objective); - - ci.cancel(); } } - @Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true) + @Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true) private void disableScoreboardRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) From fcc826c9997bc12bc1aabf28f79c52806405f39c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:05:09 -0500 Subject: [PATCH 008/128] Update Configs.java --- .../fi/dy/masa/tweakeroo/config/Configs.java | 644 ++++++------------ 1 file changed, 209 insertions(+), 435 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index bd665ef57..bd8ebbd73 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -1,11 +1,10 @@ package fi.dy.masa.tweakeroo.config; import java.io.File; - import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - +import net.minecraft.client.MinecraftClient; import fi.dy.masa.malilib.config.ConfigUtils; import fi.dy.masa.malilib.config.HudAlignment; import fi.dy.masa.malilib.config.IConfigBase; @@ -30,183 +29,86 @@ import fi.dy.masa.tweakeroo.util.InventoryUtils; import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode; import fi.dy.masa.tweakeroo.util.SnapAimMode; -import net.minecraft.client.MinecraftClient; -public class Configs implements IConfigHandler { +public class Configs implements IConfigHandler +{ private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; - public static class Generic { - public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger("afterClickerClickCount", 1, 1, - 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble("blockReachDistance", 4.5, 0, 64, - "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 4.5, the maximum is 64."); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble("entityReachDistance", 3, 0, 64, - "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is set via game rules.\nDefault is 3, and the maximum is 64."); - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList( - "blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); - public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger("breakingGridSize", 3, 1, 1000, - "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList("breakingRestrictionMode", - PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); - public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor("chatBackgroundColor", "#80000000", - "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); - public static final ConfigString CHAT_TIME_FORMAT = new ConfigString("chatTimeFormat", "[HH:mm:ss]", - "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); - public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean( - "carpetAccuratePlacementProtocol", true, - "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); - public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean("clientPlacementRotation", true, - "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); - public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger("customInventoryGuiScale", 2, - 1, 10, - "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); - public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList("elytraCameraIndicator", - ActiveMode.WITH_KEY, - "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList( - "entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, - "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); - public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger("fastBlockPlacementCount", 2, - 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); - public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean("fastLeftClickAllowTools", - false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); - public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger("fastLeftClickCount", 10, 1, 64, - "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); - public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean( - "fastPlacementRememberOrientation", true, - "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); - public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger("fastRightClickCount", 10, 1, 64, - "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); - public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger("fillCloneLimit", 10000000, 1, - 1000000000, - "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); - public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor( - "flexibleBlockPlacementOverlayColor", "#C03030F0", - "The color of the currently pointed-at\nregion in block placement the overlay"); - public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble("flyDecelerationFactor", 0.4, 0.0, - 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); - public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble("flySpeedPreset1", 0.01, 0, 4, - "The fly speed for preset 1"); - public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble("flySpeedPreset2", 0.064, 0, 4, - "The fly speed for preset 2"); - public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble("flySpeedPreset3", 0.128, 0, 4, - "The fly speed for preset 3"); - public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble("flySpeedPreset4", 0.32, 0, 4, - "The fly speed for preset 4"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean("freeCameraPlayerInputs", false, - "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); - public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean("freeCameraPlayerMovement", - false, - "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); - public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble("gammaOverrideValue", 16, 0, 32, - "The gamma value to use when the override option is enabled"); - public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean("handRestockPre", true, - "If enabled, then hand restocking happens\nbefore the stack runs out"); - public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger("handRestockPreThreshold", 6, - 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); - public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean( - "hangableEntityBypassInverse", false, - "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); - public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger("hotbarSlotCycleMax", 2, 1, 9, - "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); - public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger("hotbarSlotRandomizerMax", 5, - 1, 9, - "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); - public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList( - "hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger("hotbarSwapOverlayOffsetX", - 4, "The horizontal offset of the hotbar swap overlay"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger("hotbarSwapOverlayOffsetY", - 4, "The vertical offset of the hotbar swap overlay"); - public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger( - "itemSwapDurabilityThreshold", 20, 5, 10000, - "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); - public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean("itemUsePacketCheckBypass", - true, - "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); - public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger("mapPreviewSize", 160, 16, 512, - "The size of the rendered map previews"); - public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger("periodicAttackInterval", 20, 0, - Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); - public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger("periodicUseInterval", 20, 0, - Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger( - "periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger( - "periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, - "The number of game ticks between starting to hold down attack (left click)"); - public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger("periodicHoldUseDuration", 20, - 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); - public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger("periodicHoldUseInterval", 20, - 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); - public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean("permanentSneakAllowInGUIs", - false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); - public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger("placementGridSize", 3, 1, 1000, - "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger("placementLimit", 3, 1, 10000, - "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); - public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList( - "placementRestrictionMode", PlacementRestrictionMode.FACE, - "The Placement Restriction mode to use (hotkey-selectable)"); - public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean( - "placementRestrictionTiedToFast", true, - "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); - public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean( - "potionWarningBeneficialOnly", true, - "Only warn about potion effects running out that are marked as \"beneficial\""); - public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger("potionWarningThreshold", 600, 1, - 1000000, - "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); - public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean("rememberFlexibleFromClick", true, - "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); - public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger("renderLimitItem", -1, -1, 10000, - "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger("renderLimitXPOrb", -1, -1, 10000, - "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); - public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger("sculkSensorPulseLength", 40, 0, - 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); - public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean("shulkerDisplayBgColor", - true, - "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); - public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean( - "shulkerDisplayRequireShift", true, - "Whether or not holding shift is required for the Shulker Box preview"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean("slotSyncWorkaround", true, - "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean("slotSyncWorkaroundAlways", - false, - "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); - public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean("snapAimIndicator", true, - "Whether or not to render the snap aim angle indicator"); - public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor("snapAimIndicatorColor", "#603030FF", - "The color for the snap aim indicator background"); - public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList("snapAimMode", SnapAimMode.YAW, - "Snap aim mode: yaw, or pitch, or both"); - public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean("snapAimOnlyCloseToAngle", - true, - "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); - public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean("snapAimPitchOvershoot", false, - "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); - public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble("snapAimPitchStep", 12.5, 0, 90, - "The pitch angle step of the snap aim tweak"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble("snapAimThresholdPitch", 1.5, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble("snapAimThresholdYaw", 5.0, - "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); - public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble("snapAimYawStep", 45, 0, 360, - "The yaw angle step of the snap aim tweak"); - public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger("structureBlockMaxSize", 128, 1, - 256, "The maximum dimensions for a Structure Block's saved area"); - public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString("toolSwitchableSlots", "1-9", - "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); - public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString("toolSwitchIgnoredSlots", "", - "The slots where the Tool Switch tweak does not work when they are active."); - public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean( - "zoomAdjustMouseSensitivity", true, - "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); - public static final ConfigDouble ZOOM_FOV = new ConfigDouble("zoomFov", 30, 0.01, 359.99, - "The FOV value used for the zoom feature"); + public static class Generic + { + public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 8, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 8 for placing, 6 for breaking."); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); + public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); + public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); + public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); + public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); + public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); + public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); + public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); + public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); + public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); + public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger ("fastLeftClickCount", 10, 1, 64, "The number of left clicks to do per game tick when\ntweakFastLeftClick is enabled and the attack button is held down"); + public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean ("fastPlacementRememberOrientation", true, "If enabled, then the Fast Block Placement feature will always remember\nthe orientation of the first block you place.\nWithout this, the orientation will only be remembered\nwith the Flexible Block Placement enabled and active."); + public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger ("fastRightClickCount", 10, 1, 64, "The number of right clicks to do per game tick when\ntweakFastRightClick is enabled and the use button is held down"); + public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger ("fillCloneLimit", 10000000, 1, 1000000000, "The new /fill and /clone block limit in single player,\nif the tweak to override them is enabled"); + public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor ("flexibleBlockPlacementOverlayColor", "#C03030F0", "The color of the currently pointed-at\nregion in block placement the overlay"); + public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble ("flyDecelerationFactor", 0.4, 0.0, 1.0, "This adjusts how quickly the player will stop if the\n'customFlyDeceleration' tweak is enabled"); + public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble ("flySpeedPreset1", 0.01, 0, 4, "The fly speed for preset 1"); + public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble ("flySpeedPreset2", 0.064, 0, 4, "The fly speed for preset 2"); + public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble ("flySpeedPreset3", 0.128, 0, 4, "The fly speed for preset 3"); + public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble ("flySpeedPreset4", 0.32, 0, 4, "The fly speed for preset 4"); + public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean ("freeCameraPlayerInputs", false, "When enabled, the attacks and use actions\n(ie. left and right clicks) in Free Camera mode are\nlet through to the actual player."); + public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean ("freeCameraPlayerMovement", false, "When enabled, the movement inputs in the Free Camera mode\nwill move the actual client player instead of the camera"); + public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble ("gammaOverrideValue", 16, 0, 32, "The gamma value to use when the override option is enabled"); + public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean ("handRestockPre", true, "If enabled, then hand restocking happens\nbefore the stack runs out"); + public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger ("handRestockPreThreshold", 6, 1, 64, "The stack size threshold at which Hand Restock will happen\nin the pre-restock mode"); + public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean ("hangableEntityBypassInverse", false, "If the hangableEntityTargetingBypass tweak is enabled,\nthen this controls whether the player must be or must not be\nsneaking to be able to target the hangable entity (Item Frame or Painting).\n > true - Sneaking = ignore/bypass the entity\n > false - Sneaking = target the entity"); + public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger ("hotbarSlotCycleMax", 2, 1, 9, "This is the last hotbar slot to use/cycle through\nif the hotbar slot cycle tweak is enabled.\nBasically the cycle will jump back to the first slot\nwhen going over the maximum slot number set here."); + public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger ("hotbarSlotRandomizerMax", 5, 1, 9, "This is the last hotbar slot to use if the hotbar slot randomizer\ntweak is enabled. Basically the selected hotbar slot will be randomly\npicked from 1 to this maximum slot after an item use."); + public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList ("hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "The positioning of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger ("hotbarSwapOverlayOffsetX", 4, "The horizontal offset of the hotbar swap overlay"); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger ("hotbarSwapOverlayOffsetY", 4, "The vertical offset of the hotbar swap overlay"); + public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger ("itemSwapDurabilityThreshold", 20, 5, 10000, "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); + public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean ("itemUsePacketCheckBypass", true, "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); + public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger ("mapPreviewSize", 160, 16, 512, "The size of the rendered map previews"); + public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger ("periodicAttackInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); + public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger ("periodicUseInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger ("periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down attack"); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger ("periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down attack (left click)"); + public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger ("periodicHoldUseDuration", 20, 0, Integer.MAX_VALUE, "The number of game ticks to hold down use"); + public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger ("periodicHoldUseInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between starting to hold down use (right click)"); + public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean ("permanentSneakAllowInGUIs", false, "If true, then the permanent sneak tweak will\nalso work while GUIs are open"); + public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger ("placementGridSize", 3, 1, 1000, "The grid interval size for the grid placement mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger ("placementLimit", 3, 1, 10000, "The number of blocks you are able to place at maximum per\nright click, if tweakPlacementLimit is enabled.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); + public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList ("placementRestrictionMode", PlacementRestrictionMode.FACE, "The Placement Restriction mode to use (hotkey-selectable)"); + public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean ("placementRestrictionTiedToFast", true, "When enabled, the Placement Restriction mode will toggle\nits state of/off when you toggle the Fast Placement mode."); + public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean ("potionWarningBeneficialOnly", true, "Only warn about potion effects running out that are marked as \"beneficial\""); + public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger ("potionWarningThreshold", 600, 1, 1000000, "The remaining duration of potion effects (in ticks)\nafter which the warning will start showing"); + public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean ("rememberFlexibleFromClick", true, "If enabled, then the Flexible Block Placement status\nwill be remembered from the first placed block,\nas long as the use key (right click) is held down.\nBasically you don't have to keep holding all the flexible\nactivation keys to fast place all the blocks in the same orientation."); + public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger ("renderLimitItem", -1, -1, 10000, "Maximum number of item entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger ("renderLimitXPOrb", -1, -1, 10000, "Maximum number of XP orb entities rendered per frame.\nUse -1 for normal behaviour, ie. to disable this limit."); + public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); + public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true, "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); + public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true, "Whether or not holding shift is required for the Shulker Box preview"); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true, "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false, "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); + public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true, "Whether or not to render the snap aim angle indicator"); + public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor ("snapAimIndicatorColor", "#603030FF", "The color for the snap aim indicator background"); + public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList ("snapAimMode", SnapAimMode.YAW, "Snap aim mode: yaw, or pitch, or both"); + public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean ("snapAimOnlyCloseToAngle", true, "If enabled, then the snap aim only snaps to the angle\nwhen the internal angle is within a certain distance of it.\nThe threshold can be set in snapAimThreshold"); + public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean ("snapAimPitchOvershoot", false, "Whether or not to allow overshooting the pitch angle\nfrom the normal +/- 90 degrees up to +/- 180 degrees"); + public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble ("snapAimPitchStep", 12.5, 0, 90, "The pitch angle step of the snap aim tweak"); + public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble ("snapAimThresholdPitch", 1.5, "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble ("snapAimThresholdYaw", 5.0, "The angle threshold inside which the player rotation will\nbe snapped to the snap angle."); + public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble ("snapAimYawStep", 45, 0, 360, "The yaw angle step of the snap aim tweak"); + public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger ("structureBlockMaxSize", 128, 1, 256, "The maximum dimensions for a Structure Block's saved area"); + public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString ("toolSwitchableSlots", "1-9", "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots"); + public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString ("toolSwitchIgnoredSlots", "", "The slots where the Tool Switch tweak does not work when they are active."); + public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean ("zoomAdjustMouseSensitivity", true, "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active"); + public static final ConfigDouble ZOOM_FOV = new ConfigDouble ("zoomFov", 30, 0.01, 359.99, "The FOV value used for the zoom feature"); public static final ImmutableList OPTIONS = ImmutableList.of( CARPET_ACCURATE_PLACEMENT_PROTOCOL, @@ -285,114 +187,51 @@ public static class Generic { STRUCTURE_BLOCK_MAX_SIZE, TOOL_SWITCHABLE_SLOTS, TOOL_SWITCH_IGNORED_SLOTS, - ZOOM_FOV); + ZOOM_FOV + ); } - public static class Fixes { - public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, - "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); - public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, - "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); - public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean( - "ravagerClientBlockBreakFix", false, - "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); + public static class Fixes + { + public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, "Elytra landing fix by Earthcomputer and Nessie.\nThe deployment fix is now in vanilla, so this only affects landing now."); + public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, "If you are on Mac/OSX, this applies the same fix/change\nas the hscroll mod, while not breaking all the scroll handling\nin malilib-based mods."); + public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean("ravagerClientBlockBreakFix", false, "Fixes Ravagers breaking blocks on the client side,\nwhich causes annoying ghost blocks/block desyncs"); public static final ImmutableList OPTIONS = ImmutableList.of( ELYTRA_FIX, MAC_HORIZONTAL_SCROLL, - RAVAGER_CLIENT_BLOCK_BREAK_FIX); + RAVAGER_CLIENT_BLOCK_BREAK_FIX + ); } - public static class Lists { - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "blockTypeBreakRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Block Type Break Restriction tweak"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList( - "blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), - "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList( - "blockTypeBreakRestrictionWhiteList", ImmutableList.of(), - "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); - public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", - ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", - "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", - "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", - "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), - "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList( - "entityTypeAttackRestrictionListType", ListType.BLACKLIST, - "The restriction list type for the Entity Type Attack Restriction tweak"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList( - "entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), - "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList( - "entityTypeAttackRestrictionWhiteList", ImmutableList.of(), - "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", - ImmutableList.of( - " => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", - "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", - "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), - "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); - public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList( - "fastPlacementItemListType", ListType.BLACKLIST, - "The item restriction type for the Fast Block Placement tweak"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList( - "fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), - "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList( - "fastPlacementItemWhiteList", ImmutableList.of(), - "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList( - "fastRightClickBlockListType", ListType.BLACKLIST, - "The targeted block restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList( - "fastRightClickBlockBlackList", - ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", - "minecraft:white_shulker_box"), - "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList( - "fastRightClickBlockWhiteList", ImmutableList.of(), - "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); - public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList( - "fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList( - "fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), - "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList( - "fastRightClickWhiteList", - ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", - "minecraft:glass_bottle"), - "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); - public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", - ImmutableList.of( - "White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", - "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), - "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); - public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", - ListType.NONE, "The restriction list type for the Hand Restock tweak"); - public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", - ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), - "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); - public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", - ImmutableList.of(), - "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); - public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", - ListType.NONE, "The list type for potion warning effects"); - public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", - ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", - "minecraft:slowness", "minecraft:weakness"), - "The potion effects that will not be warned about"); - public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", - ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), - "The only potion effects that will be warned about"); - public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", - ImmutableList.of("mainhand", "offhand"), - "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); - public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", - ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), - "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); + public static class Lists + { + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList("blockTypeBreakRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Block Type Break Restriction tweak"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList("blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList("blockTypeBreakRestrictionWhiteList", ImmutableList.of(), "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); + public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Entity Type Attack Restriction tweak"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); + public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST, "The item restriction type for the Fast Block Placement tweak"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); + public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of(), "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList("fastRightClickBlockListType", ListType.BLACKLIST, "The targeted block restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList("fastRightClickBlockBlackList", ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", "minecraft:white_shulker_box"), "The blocks that are NOT allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList("fastRightClickBlockWhiteList", ImmutableList.of(), "The blocks that are allowed to be right clicked on with\nthe Fast Right Click tweak, if the fastRightClickBlockListType is set to White List"); + public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList("fastRightClickListType", ListType.NONE, "The item restriction type for the Fast Right Click tweak"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList("fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), "The items that are NOT allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to Black List"); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList("fastRightClickWhiteList", ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", "minecraft:glass_bottle"), "The items that are allowed to be used for the Fast Right Click tweak,\nif the fastRightClickListType is set to White List"); + public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", ImmutableList.of("White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), "Custom flat world preset strings.\nThese are in the format: name;blocks_string;biome;generation_features;icon_item\nThe blocks string format is the vanilla format, such as: 62*minecraft:dirt,minecraft:grass\nThe biome can be the registry name, or the int ID\nThe icon item name format is minecraft:iron_nugget"); + public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", ListType.NONE, "The restriction list type for the Hand Restock tweak"); + public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), "The items that are NOT allowed to be restocked with the Hand Restock tweak,\nif the handRestockListType is set to Black List"); + public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", ImmutableList.of(), "The only allowed items that can be restocked with the Hand Restock tweak,\nif the handRestockListType is set to White List"); + public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", ListType.NONE, "The list type for potion warning effects"); + public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", "minecraft:slowness", "minecraft:weakness"), "The potion effects that will not be warned about"); + public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), "The only potion effects that will be warned about"); + public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", ImmutableList.of("mainhand", "offhand"), "The slots the repair mode should use\nValid values: mainhand, offhand, head, chest, legs, feet"); + public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), "The items that should be considered for the\n'tweakItemUnstackingProtection' tweak"); public static final ImmutableList OPTIONS = ImmutableList.of( BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, @@ -420,114 +259,56 @@ public static class Lists { POTION_WARNING_BLACKLIST, POTION_WARNING_WHITELIST, REPAIR_MODE_SLOTS, - UNSTACKING_ITEMS); + UNSTACKING_ITEMS + ); } - public static class Disable { - public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed( - "disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); - public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed( - "disableAxeStripping", false, "", "Disables stripping logs with an axe"); - public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient("disableBatSpawning", - false, "", "Disables Bat spawning in single player"); - public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed( - "disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed( - "disableBlockBreakingParticles", false, "", - "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed( - "disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, - "", "Disables boss bar rendering"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, - "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed( - "disableChunkRendering", false, "", - "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed( - "disableClientEntityUpdates", false, "", - "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed( - "disableClientLightUpdates", false, "", "Disables all client-side light updates"); - public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed( - "disableConstantChunkSaving", false, "", - "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); - public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS = new ConfigBooleanHotkeyed( - "disableCreativeMenuInfestedBlocks", false, "", - "Removes infested stone blocks from the creative search inventory"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed( - "disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed( - "disableDeadMobTargeting", false, "", - "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableEntityRendering", false, "", - "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient( - "disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed( - "disableFallingBlockEntityRendering", false, "", - "If enabled, then falling block entities won't be rendered at all"); - public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed( - "disableFirstPersonEffectParticles", false, "", - "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); - public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed( - "disableInventoryEffectRendering", false, "", - "Removes the potion effect rendering from the inventory GUIs"); - public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed( - "disableItemSwitchRenderCooldown", false, "", - "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); - public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed( - "disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); - public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed( - "disableNauseaEffect", false, "", "Disables the nausea visual effects"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", - false, "", "Removes the fog in the Nether"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed( - "disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); - public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient("disableObserver", false, - "", "Disable Observers from triggering at all"); - public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed( - "disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); - public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", - false, "", "Disables all particles"); - public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed( - "disablePortalGuiClosing", false, "", - "If enabled, then you can still open GUIs while in a Nether Portal"); - public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", - false, "", "Disables rain rendering and sounds"); - public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed( - "disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); - public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed( - "disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); - public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed( - "disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); - public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed( - "disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); - public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed( - "disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); - public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, - "", "Prevent the Sign edit GUI from opening"); - public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", - false, "", - "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); - public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed( - "disableSlimeBlockSlowdown", false, "", - "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); - public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed( - "disableStatusEffectHud", false, "", - "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed( - "disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient( - "disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient( - "disableVillagerTradeLocking", false, "", - "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); - public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed( - "disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed( - "disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); + public static class Disable + { + public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed("disableArmorStandRendering", false, "", "Disables all Armor Stand entity rendering"); + public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed("disableAxeStripping", false, "", "Disables stripping logs with an axe"); + public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient ("disableBatSpawning", false, "", "Disables Bat spawning in single player"); + public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed("disableBeaconBeamRendering", false, "", "Disables Beacon beam rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed("disableBlockBreakingParticles", false, "", "Removes the block breaking particles.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "Disables boss bar rendering"); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "Removes the fog that boss mobs cause"); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "Disables all client-side light updates"); + public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); + public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS= new ConfigBooleanHotkeyed("disableCreativeMenuInfestedBlocks", false, "", "Removes infested stone blocks from the creative search inventory"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed("disableDeadMobRendering", false, "", "Prevents rendering dead mobs (entities that are at 0 health)"); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed("disableDeadMobTargeting", false, "", "Prevents targeting entities that are at 0 health.\nThis fixes for example hitting already dead mobs."); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableEntityRendering", false, "", "Disables ALL except player entity rendering.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient ("disableEntityTicking", false, "", "Prevent everything except player entities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed("disableFallingBlockEntityRendering", false, "", "If enabled, then falling block entities won't be rendered at all"); + public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed("disableFirstPersonEffectParticles", false, "", "Removes the potion effect particles/swirlies in first person\n(from the player itself)"); + public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed("disableInventoryEffectRendering", false, "", "Removes the potion effect rendering from the inventory GUIs"); + public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed("disableItemSwitchRenderCooldown", false, "", "If true, then there won't be any cooldown/equip animation\nwhen switching the held item or using the item."); + public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed("disableMobSpawnerMobRendering", false, "", "Removes the entity rendering from mob spawners"); + public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed("disableNauseaEffect", false, "", "Disables the nausea visual effects"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", false, "", "Removes the fog in the Nether"); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed("disableNetherPortalSound", false, "", "Disables the Nether Portal sound"); + public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient ("disableObserver", false, "", "Disable Observers from triggering at all"); + public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed("disableOffhandRendering", false, "", "Disables the offhand item from getting rendered"); + public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", false, "", "Disables all particles"); + public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed("disablePortalGuiClosing", false, "", "If enabled, then you can still open GUIs while in a Nether Portal"); + public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", false, "", "Disables rain rendering and sounds"); + public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed("disableRenderingScaffolding", false, "", "Disables rendering of Scaffolding Blocks"); + public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed("disableRenderDistanceFog", false, "", "Disables the fog that increases around the render distance"); + public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed("disableScoreboardRendering", false, "", "Removes the sidebar scoreboard rendering"); + public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed("disableShulkerBoxTooltip", false, "", "Disables the vanilla text tooltip for Shulker Box contents"); + public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed("disableShovelPathing", false, "", "Disables converting grass etc. to Path Blocks with a shovel"); + public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, "", "Prevent the Sign edit GUI from opening"); + public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", false, "", "Disables the sky darkness below y = 63\n\n(By moving the threshold y to 2 blocks below the bottom of the world instead)"); + public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed("disableSlimeBlockSlowdown", false, "", "Removes the slowdown from walking on Slime Blocks.\n(This is originally from usefulmod by nessie.)"); + public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); + public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); public static final ImmutableList OPTIONS = ImmutableList.of( DISABLE_ARMOR_STAND_RENDERING, @@ -573,54 +354,50 @@ public static class Disable { DISABLE_TILE_ENTITY_TICKING, DISABLE_VILLAGER_TRADE_LOCKING, DISABLE_WALL_UNSPRINT, - DISABLE_WORLD_VIEW_BOB); + DISABLE_WORLD_VIEW_BOB + ); } - public static class Internal { - public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger("flySpeedPreset", 0, 0, 3, - "This is just for the mod internally to track the\ncurrently selected fly speed preset"); - public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble("gammaValueOriginal", 0, 0, 1, - "The original gamma value, before the gamma override was enabled"); - public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger("hotbarScrollCurrentRow", 3, 0, - 3, - "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); - public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble( - "slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); - public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble("snapAimLastPitch", 0, -135, 135, - "The last snapped-to pitch value"); - public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble("snapAimLastYaw", 0, 0, 360, - "The last snapped-to yaw value"); + public static class Internal + { + public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger ("flySpeedPreset", 0, 0, 3, "This is just for the mod internally to track the\ncurrently selected fly speed preset"); + public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble ("gammaValueOriginal", 0, 0, 1, "The original gamma value, before the gamma override was enabled"); + public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger ("hotbarScrollCurrentRow", 3, 0, 3, "This is just for the mod internally to track the\n\"current hotbar row\" for the hotbar scrolling feature"); + public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble ("slimeBlockSlipperinessOriginal", 0.8, 0, 1, "The original slipperiness value of Slime Blocks"); + public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble ("snapAimLastPitch", 0, -135, 135, "The last snapped-to pitch value"); + public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble ("snapAimLastYaw", 0, 0, 360, "The last snapped-to yaw value"); public static final ImmutableList OPTIONS = ImmutableList.of( FLY_SPEED_PRESET, GAMMA_VALUE_ORIGINAL, HOTBAR_SCROLL_CURRENT_ROW, SLIME_BLOCK_SLIPPERINESS_ORIGINAL, - SNAP_AIM_LAST_YAW); + SNAP_AIM_LAST_YAW + ); } - public static ConfigDouble getActiveFlySpeedConfig() { - switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) { - case 0: - return Configs.Generic.FLY_SPEED_PRESET_1; - case 1: - return Configs.Generic.FLY_SPEED_PRESET_2; - case 2: - return Configs.Generic.FLY_SPEED_PRESET_3; - case 3: - return Configs.Generic.FLY_SPEED_PRESET_4; - default: - return Configs.Generic.FLY_SPEED_PRESET_1; + public static ConfigDouble getActiveFlySpeedConfig() + { + switch (Configs.Internal.FLY_SPEED_PRESET.getIntegerValue()) + { + case 0: return Configs.Generic.FLY_SPEED_PRESET_1; + case 1: return Configs.Generic.FLY_SPEED_PRESET_2; + case 2: return Configs.Generic.FLY_SPEED_PRESET_3; + case 3: return Configs.Generic.FLY_SPEED_PRESET_4; + default: return Configs.Generic.FLY_SPEED_PRESET_1; } } - public static void loadFromFile() { + public static void loadFromFile() + { File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); - if (configFile.exists() && configFile.isFile() && configFile.canRead()) { + if (configFile.exists() && configFile.isFile() && configFile.canRead()) + { JsonElement element = JsonUtils.parseJsonFile(configFile); - if (element != null && element.isJsonObject()) { + if (element != null && element.isJsonObject()) + { JsonObject root = element.getAsJsonObject(); ConfigUtils.readConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); @@ -634,7 +411,7 @@ public static void loadFromFile() { } // TODO 1.19.3+ - // CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); + //CreativeExtraItems.setCreativeExtraItems(Lists.CREATIVE_EXTRA_ITEMS.getStrings()); InventoryUtils.setToolSwitchableSlots(Generic.TOOL_SWITCHABLE_SLOTS.getStringValue()); InventoryUtils.setToolSwitchIgnoreSlots(Generic.TOOL_SWITCH_IGNORED_SLOTS.getStringValue()); @@ -642,32 +419,27 @@ public static void loadFromFile() { InventoryUtils.setUnstackingItems(Lists.UNSTACKING_ITEMS.getStrings()); InventoryUtils.setWeaponMapping(Lists.ENTITY_WEAPON_MAPPING.getStrings()); - PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION - .setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); + PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListType((ListType) Lists.BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE.getOptionListValue()); PlacementTweaks.BLOCK_TYPE_BREAK_RESTRICTION.setListContents( Lists.BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST.getStrings(), Lists.BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST.getStrings()); - PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListType((ListType) Lists.FAST_RIGHT_CLICK_BLOCK_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_RIGHT_CLICK_BLOCK_RESTRICTION.setListContents( Lists.FAST_RIGHT_CLICK_BLOCK_BLACKLIST.getStrings(), Lists.FAST_RIGHT_CLICK_BLOCK_WHITELIST.getStrings()); - PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListType((ListType) Lists.FAST_RIGHT_CLICK_ITEM_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_RIGHT_CLICK_ITEM_RESTRICTION.setListContents( Lists.FAST_RIGHT_CLICK_ITEM_BLACKLIST.getStrings(), Lists.FAST_RIGHT_CLICK_ITEM_WHITELIST.getStrings()); - PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION - .setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); + PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListType((ListType) Lists.FAST_PLACEMENT_ITEM_LIST_TYPE.getOptionListValue()); PlacementTweaks.FAST_PLACEMENT_ITEM_RESTRICTION.setListContents( Lists.FAST_PLACEMENT_ITEM_BLACKLIST.getStrings(), Lists.FAST_PLACEMENT_ITEM_WHITELIST.getStrings()); - PlacementTweaks.HAND_RESTOCK_RESTRICTION - .setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); + PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListType((ListType) Lists.HAND_RESTOCK_LIST_TYPE.getOptionListValue()); PlacementTweaks.HAND_RESTOCK_RESTRICTION.setListContents( Lists.HAND_RESTOCK_BLACKLIST.getStrings(), Lists.HAND_RESTOCK_WHITELIST.getStrings()); @@ -677,25 +449,25 @@ public static void loadFromFile() { Lists.POTION_WARNING_BLACKLIST.getStrings(), Lists.POTION_WARNING_WHITELIST.getStrings()); - MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION - .setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); + MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListType((ListType) Lists.ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE.getOptionListValue()); MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.setListContents( Lists.ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST.getStrings(), Lists.ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST.getStrings()); - if (MinecraftClient.getInstance().world == null) { - // Turn off after loading the configs, just in case it was enabled in the config - // somehow. - // But only if we are currently not in a world, since changing configs also - // re-loads them when closing the menu. + if (MinecraftClient.getInstance().world == null) + { + // Turn off after loading the configs, just in case it was enabled in the config somehow. + // But only if we are currently not in a world, since changing configs also re-loads them when closing the menu. FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); } } - public static void saveToFile() { + public static void saveToFile() + { File dir = FileUtils.getConfigDirectory(); - if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) + { JsonObject root = new JsonObject(); ConfigUtils.writeConfigBase(root, "Fixes", Configs.Fixes.OPTIONS); @@ -711,12 +483,14 @@ public static void saveToFile() { } @Override - public void load() { + public void load() + { loadFromFile(); } @Override - public void save() { + public void save() + { saveToFile(); } } From 642790e3bf33902d06662a17a1a3e17097bb235f Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:07:36 -0500 Subject: [PATCH 009/128] IntelliJ Changes --- src/main/java/fi/dy/masa/tweakeroo/config/Configs.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index bd8ebbd73..4dbcb48e3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -37,7 +37,8 @@ public class Configs implements IConfigHandler public static class Generic { public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 8, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 8 for placing, 6 for breaking."); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); From fca9c40570ee56e2a77e9f1a8cec3baaf668e934 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:33:12 -0500 Subject: [PATCH 010/128] 24w03a - No changes --- build.gradle | 2 +- gradle.properties | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 9d425f681..45b3c869b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.4-SNAPSHOT' + id 'fabric-loom' version '1.5-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index 7296ec127..e5e528361 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,9 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 23w51b -minecraft_version = 23w51b -mappings_version = 23w51b+build.3 +minecraft_version_out = 24w03a +minecraft_version = 24w03a +mappings_version = 24w03a+build.3 -fabric_loader_version = 0.15.3 +fabric_loader_version = 0.15.5 mod_menu_version = 9.0.0 From 1faaed70df6564db0d72ed73c4be66e409c9697c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:37:42 -0500 Subject: [PATCH 011/128] 24w03b - Adds debugLogger() and attempts to replace the deprecated calls to isLiquid() -- Perhaps move to malilib if working. --- .gitignore | 1 + gradle.properties | 8 ++-- .../java/fi/dy/masa/tweakeroo/Tweakeroo.java | 8 ++++ .../fi/dy/masa/tweakeroo/config/Configs.java | 2 + .../mixin/IMixinAbstractBlockState.java | 7 +++ .../tweakeroo/mixin/MixinGameRenderer.java | 11 +++-- .../tweakeroo/tweaks/PlacementTweaks.java | 46 +++++++++++-------- src/main/resources/mixins.tweakeroo.json | 3 +- 8 files changed, 58 insertions(+), 28 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java diff --git a/.gitignore b/.gitignore index 0dd9d3a3c..0d6fbdeeb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ run .vscode libs/ .idea/ +run/ diff --git a/gradle.properties b/gradle.properties index e5e528361..ee0ac694c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,9 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w03a -minecraft_version = 24w03a -mappings_version = 24w03a+build.3 +minecraft_version_out = 24w03b +minecraft_version = 24w03b +mappings_version = 24w03b+build.5 -fabric_loader_version = 0.15.5 +fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 diff --git a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java index ce96b4d30..dfc409a21 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo; +import fi.dy.masa.tweakeroo.config.Configs; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import fi.dy.masa.malilib.event.InitializationHandler; @@ -17,4 +18,11 @@ public void onInitialize() { InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); } + public static void debugLog(String msg, Object... args) + { + if (Configs.Generic.DEBUG_LOGGING.getBooleanValue()) + { + Tweakeroo.logger.info(msg, args); + } + } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 4dbcb48e3..35bcae20c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -47,6 +47,7 @@ public static class Generic public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); + public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); @@ -114,6 +115,7 @@ public static class Generic public static final ImmutableList OPTIONS = ImmutableList.of( CARPET_ACCURATE_PLACEMENT_PROTOCOL, CLIENT_PLACEMENT_ROTATION, + DEBUG_LOGGING, FAST_LEFT_CLICK_ALLOW_TOOLS, FAST_PLACEMENT_REMEMBER_ALWAYS, FREE_CAMERA_PLAYER_INPUTS, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java new file mode 100644 index 000000000..f843445fe --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java @@ -0,0 +1,7 @@ +package fi.dy.masa.tweakeroo.mixin; + +public interface IMixinAbstractBlockState { + boolean tweakeroo$isLiquid(); + boolean tweakeroo$isSolid(); + boolean tweakeroo$blocksMovement(); +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index 43c3f0df0..5c715d818 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; @@ -34,7 +35,9 @@ public abstract class MixinGameRenderer @Shadow protected abstract void bobView(MatrixStack matrices, float tickDelta); + @Unique private float realYaw; + @Unique private float realPitch; @Inject(method = "renderWorld", at = @At("HEAD"), cancellable = true) @@ -69,7 +72,8 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) } } - @Redirect(method = "updateTargetedEntity", at = @At(value = "INVOKE", + // Method renamed + @Redirect(method = "updateCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;")) private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) { @@ -87,7 +91,8 @@ private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) return mc.getCameraEntity(); } - @ModifyArg(method = "updateTargetedEntity", + // Call moved to findCrosshairTarget() + @ModifyArg(method = "findCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/ProjectileUtil;raycast(" + "Lnet/minecraft/entity/Entity;" + @@ -114,7 +119,7 @@ private Predicate overrideTargetedEntityCheck(Predicate predicat @Inject(method = "renderWorld", at = @At( value = "INVOKE", shift = Shift.AFTER, - target = "Lnet/minecraft/client/render/GameRenderer;updateTargetedEntity(F)V")) + target = "Lnet/minecraft/client/render/GameRenderer;updateCrosshairTarget(F)V")) private void overrideRenderViewEntityPre(CallbackInfo ci) { if (FeatureToggle.TWEAK_ELYTRA_CAMERA.getBooleanValue() && Hotkeys.ELYTRA_CAMERA.getKeybind().isKeybindHeld()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 2b4633b94..a078b1134 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -2,6 +2,8 @@ import javax.annotation.Nullable; +import fi.dy.masa.tweakeroo.Tweakeroo; +import fi.dy.masa.tweakeroo.mixin.IMixinAbstractBlockState; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -132,7 +134,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { if (isEmulatedClick == false) { - //System.out.printf("onProcessRightClickPre storing stack: %s\n", stackOriginal); + //Tweakeroo.debugLog("onProcessRightClickPre storing stack: %s\n", stackOriginal); cacheStackInHand(hand); } @@ -147,7 +149,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { - //System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); + //Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } @@ -361,7 +363,7 @@ public static ActionResult onProcessRightClickBlock( return ActionResult.PASS; } - //System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); + //Tweakeroo.debugLog("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); // Store the initial click data for the fast placement mode @@ -387,7 +389,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - //System.out.printf("plop store @ %s\n", posFirst); + //Tweakeroo.debugLog("plop store @ %s\n", posFirst); } return result; @@ -501,7 +503,7 @@ private static ActionResult tryPlaceBlock( { facing = facing.getOpposite(); } - //System.out.printf("accurate - IN - facing: %s\n", facing); + //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: %s\n", facing); } else if (flexible == false || rotation == false) { @@ -526,7 +528,7 @@ else if (flexible == false || rotation == false) } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - //System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); + //Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); if (facingTmp != null) { @@ -541,7 +543,7 @@ else if (flexible == false || rotation == false) if (accurateReverse) { - //System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); + //Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); if (accurateIn || flexible == false || rotation == false) { facing = facing.getOpposite(); @@ -568,13 +570,13 @@ else if (flexible == false || rotation == false) x += afterClickerClickCount * 16; } - //System.out.printf("accurate - pre hitVec: %s\n", hitVec); - //System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); + //Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: %s\n", hitVec); + //Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - //System.out.printf("accurate - post hitVec: %s\n", hitVec); + //Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: %s\n", hitVec); } - //System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); + //Tweakeroo.debugLog("PlacementTweaks#accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } @@ -585,7 +587,8 @@ else if (flexible == false || rotation == false) if (canPlaceBlockIntoPosition(world, posNew, ctx)) { - //System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posNew, side, hitPart, hitVec); + // Re-enable Debug logging for now + Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s", posNew, side, hitPart, hitVec); return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); } else @@ -704,7 +707,7 @@ private static ActionResult processRightClickBlockWrapper( Vec3d hitVecIn, Hand hand) { - //System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); + //Tweakeroo.debugLog("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); if (FeatureToggle.TWEAK_PLACEMENT_LIMIT.getBooleanValue() && placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) { @@ -749,7 +752,7 @@ private static ActionResult processRightClickBlockWrapper( if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) { - //System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); + //Tweakeroo.debugLog("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); return ActionResult.PASS; } @@ -779,7 +782,7 @@ private static ActionResult processRightClickBlockWrapper( x += afterClickerClickCount * 16; } - //System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); + //Tweakeroo.debugLog("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } @@ -802,7 +805,7 @@ private static ActionResult processRightClickBlockWrapper( InventoryUtils.trySwapCurrentToolIfNearlyBroken(); - //System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); + //Tweakeroo.debugLog("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); ActionResult result; if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) @@ -811,7 +814,7 @@ private static ActionResult processRightClickBlockWrapper( } else { - //System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); + //Tweakeroo.debugLog("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posIn, false); result = controller.interactBlock(player, hand, context); } @@ -823,7 +826,7 @@ private static ActionResult processRightClickBlockWrapper( // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - //System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); + //Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && @@ -832,7 +835,7 @@ private static ActionResult processRightClickBlockWrapper( { for (int i = 0; i < afterClickerClickCount; i++) { - //System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); + //Tweakeroo.debugLog("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posPlacement, false); result = controller.interactBlock(player, hand, context); } @@ -895,7 +898,7 @@ else if (hitPart == HitPart.RIGHT) player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - //System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); + //Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); @@ -1075,6 +1078,9 @@ private static BlockPos getPlacementPositionForTargetedPosition(World world, Blo private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) { BlockState state = world.getBlockState(pos); + IMixinAbstractBlockState fixed_state = (IMixinAbstractBlockState) state; + // Verify Mixin is working before totally removing state.isLiquid() --> DebugLogger added + Tweakeroo.debugLog("PlacementTweaks#canPlaceBlockIntoPosition(): BlockState.isLiquid() fixed: {}/orig: {}", fixed_state.tweakeroo$isLiquid(), state.isLiquid()); return state.canReplace(useContext) || state.isLiquid() || state.isReplaceable(); } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index bcb63a693..92a4905a3 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -5,13 +5,14 @@ "compatibilityLevel": "JAVA_17", "client": [ "IMixinAbstractBlock", + "IMixinAbstractHorseEntity", "IMixinAxeItem", "IMixinChunkLightProvider", "IMixinClientWorld", "IMixinCommandBlockExecutor", - "IMixinAbstractHorseEntity", "IMixinShovelItem", "IMixinSimpleOption", + "MixinAbstractBlockState", "MixinAbstractClientPlayerEntity", "MixinAbstractInventoryScreen", "MixinAbstractSignEditScreen", From 11d5829117c633d5203af373953221eea706b78a Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:37:51 -0500 Subject: [PATCH 012/128] 24w03b - Adds debugLogger() and attempts to replace the deprecated calls to isLiquid() -- Perhaps move to malilib if working. --- .../mixin/MixinAbstractBlockState.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java new file mode 100644 index 000000000..6917293b8 --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java @@ -0,0 +1,53 @@ +package fi.dy.masa.tweakeroo.mixin; + +import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.MapCodec; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.state.property.Property; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import net.minecraft.state.State; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +/* + This Mixin is to replace the @Deprecated calls to isSolid(), isLiquid(), and blocksMovement() + --> Perhaps move to malilib if working for more mods to use + */ +@Mixin(AbstractBlock.AbstractBlockState.class) +public abstract class MixinAbstractBlockState extends State implements IMixinAbstractBlockState { + protected MixinAbstractBlockState(Block owner, ImmutableMap, Comparable> entries, MapCodec codec) { + super(owner, entries, codec); + } + @Shadow public abstract Block getBlock(); + // This removes the Deprecated warnings + // --> Will adjust later if this gets removed + @Shadow @Final @SuppressWarnings("Deprecated") private boolean liquid; + @Unique + private boolean this_solid; + @Unique + private final boolean this_liquid = liquid; + @Inject(method = "shouldBeSolid", at = @At("RETURN")) + private void checkSolid(CallbackInfoReturnable cir) { + this_solid = cir.getReturnValue(); + } + @Unique + public boolean tweakeroo$isLiquid() { + return this_liquid; + } + @Unique + public boolean tweakeroo$isSolid() { + return this_solid; + } + @Unique + public boolean tweakeroo$blocksMovement() { + Block block = this.getBlock(); + return block != Blocks.COBWEB && block != Blocks.BAMBOO_SAPLING && this.tweakeroo$isSolid(); + } +} From 61eaa5bae66eb18a3a0881b64a1b469c7861a386 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 29 Jan 2024 01:11:01 -0500 Subject: [PATCH 013/128] 24w04a - Removed some non-working dev code --- build.gradle | 4 +- gradle.properties | 7 +-- .../fi/dy/masa/tweakeroo/config/Configs.java | 4 +- .../masa/tweakeroo/config/FeatureToggle.java | 2 +- .../tweakeroo/event/WorldLoadListener.java | 1 + .../mixin/IMixinAbstractBlockState.java | 7 --- .../mixin/MixinAbstractBlockState.java | 53 ------------------- .../tweakeroo/tweaks/PlacementTweaks.java | 4 -- src/main/resources/mixins.tweakeroo.json | 4 +- 9 files changed, 13 insertions(+), 73 deletions(-) delete mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java delete mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java diff --git a/build.gradle b/build.gradle index 45b3c869b..b2194487e 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,9 @@ dependencies { modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version_out}:${project.malilib_version}" // Fabric API. This is technically optional, but you probably want it anyway. - //modCompile "net.fabricmc.fabric-api:fabric-api:" + project.fabric_version + //include(modApi(fabricApi.module("fabric-api-base", project.fabric_api_version))) + include(modApi(fabricApi.module("fabric-networking-api-v1", project.fabric_api_version))) + include(modApi(fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version))) modCompileOnly "com.terraformersmc:modmenu:${project.mod_menu_version}" } diff --git a/gradle.properties b/gradle.properties index ee0ac694c..b0cf68a36 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w03b -minecraft_version = 24w03b -mappings_version = 24w03b+build.5 +minecraft_version_out = 24w04a +minecraft_version = 24w04a +mappings_version = 24w04a+build.2 fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 +fabric_api_version = 0.95.2+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 35bcae20c..726335371 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -38,7 +38,6 @@ public static class Generic { public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); @@ -49,6 +48,7 @@ public static class Generic public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); @@ -151,9 +151,9 @@ public static class Generic AFTER_CLICKER_CLICK_COUNT, BLOCK_REACH_DISTANCE, - ENTITY_REACH_DISTANCE, BREAKING_GRID_SIZE, CUSTOM_INVENTORY_GUI_SCALE, + ENTITY_REACH_DISTANCE, FAST_BLOCK_PLACEMENT_COUNT, FAST_LEFT_CLICK_COUNT, FAST_RIGHT_CLICK_COUNT, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 5211bbbba..1a92a9b7c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -23,7 +23,6 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable blockReachDistance"), - TWEAK_ENTITY_REACH_OVERRIDE ("tweakEntityReachOverride", false, "", "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), TWEAK_BREAKING_RESTRICTION ("tweakBreakingRestriction", false, "", "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), @@ -38,6 +37,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable flyDecelerationRampValue"), TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), TWEAK_ELYTRA_CAMERA ("tweakElytraCamera", false, "", "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), + TWEAK_ENTITY_REACH_OVERRIDE ("tweakEntityReachOverride", false, "", "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction",false, "", "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), TWEAK_SHULKERBOX_STACKING ("tweakEmptyShulkerBoxesStack", false, true, "", "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), TWEAK_SHULKERBOX_STACK_GROUND ("tweakEmptyShulkerBoxesStackOnGround", false, true, "", "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java index 2a4a0be89..5554a9db7 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java @@ -13,5 +13,6 @@ public void onWorldLoadPre(@Nullable ClientWorld worldBefore, @Nullable ClientWo { // Always disable the Free Camera mode when leaving the world or switching dimensions FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); + FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java deleted file mode 100644 index f843445fe..000000000 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlockState.java +++ /dev/null @@ -1,7 +0,0 @@ -package fi.dy.masa.tweakeroo.mixin; - -public interface IMixinAbstractBlockState { - boolean tweakeroo$isLiquid(); - boolean tweakeroo$isSolid(); - boolean tweakeroo$blocksMovement(); -} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java deleted file mode 100644 index 6917293b8..000000000 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractBlockState.java +++ /dev/null @@ -1,53 +0,0 @@ -package fi.dy.masa.tweakeroo.mixin; - -import com.google.common.collect.ImmutableMap; -import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.state.property.Property; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import net.minecraft.state.State; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -/* - This Mixin is to replace the @Deprecated calls to isSolid(), isLiquid(), and blocksMovement() - --> Perhaps move to malilib if working for more mods to use - */ -@Mixin(AbstractBlock.AbstractBlockState.class) -public abstract class MixinAbstractBlockState extends State implements IMixinAbstractBlockState { - protected MixinAbstractBlockState(Block owner, ImmutableMap, Comparable> entries, MapCodec codec) { - super(owner, entries, codec); - } - @Shadow public abstract Block getBlock(); - // This removes the Deprecated warnings - // --> Will adjust later if this gets removed - @Shadow @Final @SuppressWarnings("Deprecated") private boolean liquid; - @Unique - private boolean this_solid; - @Unique - private final boolean this_liquid = liquid; - @Inject(method = "shouldBeSolid", at = @At("RETURN")) - private void checkSolid(CallbackInfoReturnable cir) { - this_solid = cir.getReturnValue(); - } - @Unique - public boolean tweakeroo$isLiquid() { - return this_liquid; - } - @Unique - public boolean tweakeroo$isSolid() { - return this_solid; - } - @Unique - public boolean tweakeroo$blocksMovement() { - Block block = this.getBlock(); - return block != Blocks.COBWEB && block != Blocks.BAMBOO_SAPLING && this.tweakeroo$isSolid(); - } -} diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index a078b1134..87c5ae667 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -3,7 +3,6 @@ import javax.annotation.Nullable; import fi.dy.masa.tweakeroo.Tweakeroo; -import fi.dy.masa.tweakeroo.mixin.IMixinAbstractBlockState; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -1078,9 +1077,6 @@ private static BlockPos getPlacementPositionForTargetedPosition(World world, Blo private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) { BlockState state = world.getBlockState(pos); - IMixinAbstractBlockState fixed_state = (IMixinAbstractBlockState) state; - // Verify Mixin is working before totally removing state.isLiquid() --> DebugLogger added - Tweakeroo.debugLog("PlacementTweaks#canPlaceBlockIntoPosition(): BlockState.isLiquid() fixed: {}/orig: {}", fixed_state.tweakeroo$isLiquid(), state.isLiquid()); return state.canReplace(useContext) || state.isLiquid() || state.isReplaceable(); } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index 92a4905a3..f93f0f46a 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -12,7 +12,6 @@ "IMixinCommandBlockExecutor", "IMixinShovelItem", "IMixinSimpleOption", - "MixinAbstractBlockState", "MixinAbstractClientPlayerEntity", "MixinAbstractInventoryScreen", "MixinAbstractSignEditScreen", @@ -79,5 +78,6 @@ "mixinPriority": 990, "injectors": { "defaultRequire": 0 - } + }, + "mixins": [] } From d2b96bbf21e5bb85aefb3b5acf997ca3545d082c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 5 Feb 2024 01:46:51 -0500 Subject: [PATCH 014/128] 24w04a - gradle 8.6 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e0930..a80b22ce5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 483d48e73cee41a23dba29d58d7f1f13bde27a65 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:47:44 -0500 Subject: [PATCH 015/128] 24w05b - half works and runs, but some features are broken due to renderer issues. --- gradle.properties | 8 +- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 + .../masa/tweakeroo/event/RenderHandler.java | 14 +- .../masa/tweakeroo/mixin/MixinItemEntity.java | 8 +- .../mixin/MixinNetherPortalBlock.java | 2 +- .../tweakeroo/mixin/MixinRavagerEntity.java | 2 +- .../tweakeroo/mixin/MixinShulkerBoxBlock.java | 8 +- .../tweakeroo/mixin/MixinSignBlockEntity.java | 3 +- .../mixin/MixinTrialSpawnerState.java | 23 +++ .../dy/masa/tweakeroo/mixin/MixinWorld.java | 2 +- .../tweakeroo/mixin/MixinWorldRenderer.java | 7 +- .../masa/tweakeroo/renderer/RenderUtils.java | 42 ++++- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 2 + .../tweakeroo/util/CreativeExtraItems.java | 6 +- .../dy/masa/tweakeroo/util/IEntityItem.java | 2 +- src/main/resources/mixins.tweakeroo.json | 164 +++++++++--------- 16 files changed, 178 insertions(+), 117 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java diff --git a/gradle.properties b/gradle.properties index b0cf68a36..9f4aa99c1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w04a -minecraft_version = 24w04a -mappings_version = 24w04a+build.2 +minecraft_version_out = 24w05b +minecraft_version = 24w05b +mappings_version = 24w05b+build.2 fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 -fabric_api_version = 0.95.2+1.20.5 +fabric_api_version = 0.95.5+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 726335371..fe7095c09 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -309,6 +309,7 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); + public static final ConfigBooleanHotkeyed DISABLE_TRIAL_SPAWNER_PARTICLE = new ConfigBooleanClient ("disableTrialSpawnerParticles", false, "", "Removes the particle rendering from trial spawners"); public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); @@ -355,6 +356,7 @@ public static class Disable DISABLE_STATUS_EFFECT_HUD, DISABLE_TILE_ENTITY_RENDERING, DISABLE_TILE_ENTITY_TICKING, + DISABLE_TRIAL_SPAWNER_PARTICLE, DISABLE_VILLAGER_TRADE_LOCKING, DISABLE_WALL_UNSPRINT, DISABLE_WORLD_VIEW_BOB diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 33726e1ff..1138c9b06 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -5,7 +5,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.item.FilledMapItem; import net.minecraft.item.ItemStack; @@ -80,7 +79,7 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, } else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { - boolean render = Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown(); + boolean render = !Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown(); if (render) { @@ -90,17 +89,20 @@ else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) } @Override - public void onRenderWorldLast(MatrixStack matrixStack, Matrix4f projMatrix) + public void onRenderWorldLast(Matrix4f matrix4f, Matrix4f projMatrix) { MinecraftClient mc = MinecraftClient.getInstance(); if (mc.player != null) { - this.renderOverlays(matrixStack, mc); + //MatrixStack matrixStack = new MatrixStack(); + //matrixStack.multiplyPositionMatrix(matrix4f); + + this.renderOverlays(matrix4f, mc); } } - private void renderOverlays(MatrixStack matrixStack, MinecraftClient mc) + private void renderOverlays(Matrix4f matrix4f, MinecraftClient mc) { Entity entity = mc.getCameraEntity(); @@ -127,7 +129,7 @@ private void renderOverlays(MatrixStack matrixStack, MinecraftClient mc) hitResult.getSide(), hitResult.getPos(), color, - matrixStack, + matrix4f, mc); RenderSystem.enableDepthTest(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 32152d5be..9af59400b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -33,7 +33,7 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) } @Override - public int getPickupDelay() + public int tweakeroo$getPickupDelay() { return this.pickupDelay; } @@ -84,16 +84,16 @@ private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) if (stackSelf.getItem() instanceof BlockItem && ((BlockItem) stackSelf.getItem()).getBlock() instanceof ShulkerBoxBlock && stackSelf.getItem() == stackOther.getItem() && - fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) == false && + !fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) && // Only stack up to 64, and don't steal from other stacks that are larger stackSelf.getCount() < 64 && stackSelf.getCount() >= stackOther.getCount() && - ItemStack.canCombine(stackSelf, stackOther)) + ItemStack.areItemsAndNbtEqual(stackSelf, stackOther)) { int amount = Math.min(stackOther.getCount(), 64 - stackSelf.getCount()); stackSelf.increment(amount); self.setStack(stackSelf); - this.pickupDelay = Math.max(((IEntityItem) other).getPickupDelay(), this.pickupDelay); + this.pickupDelay = Math.max(((IEntityItem) other).tweakeroo$getPickupDelay(), this.pickupDelay); this.itemAge = Math.min(other.getItemAge(), this.itemAge); if (amount >= stackOther.getCount()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java index a1bccb1e0..15f182404 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java @@ -17,7 +17,7 @@ public abstract class MixinNetherPortalBlock private void tweakeroo_disablePortalSound(World instance, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean useDistance) { - if (Configs.Disable.DISABLE_NETHER_PORTAL_SOUND.getBooleanValue() == false) + if (!Configs.Disable.DISABLE_NETHER_PORTAL_SOUND.getBooleanValue()) { instance.playSound(x, y, z, sound, category, volume, pitch, useDistance); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java index 0c2e7ff82..4e559b49d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java @@ -16,7 +16,7 @@ private boolean fixDontBreakBlocksOnClient(RavagerEntity entity) { if (Configs.Fixes.RAVAGER_CLIENT_BLOCK_BREAK_FIX.getBooleanValue()) { - return entity.horizontalCollision && entity.getEntityWorld().isClient == false; + return entity.horizontalCollision && !entity.getEntityWorld().isClient; } return entity.horizontalCollision; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index 18ce33ba4..360d27e92 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -1,6 +1,8 @@ package fi.dy.masa.tweakeroo.mixin; import java.util.List; + +import net.minecraft.registry.DynamicRegistryManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -16,11 +18,7 @@ public abstract class MixinShulkerBoxBlock { @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void removeVanillaTooltip(ItemStack stack, - BlockView world, - List tooltip, - TooltipContext options, - CallbackInfo ci) + private void removeVanillaTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options, DynamicRegistryManager registryManager, CallbackInfo ci) { if (Configs.Disable.DISABLE_SHULKER_BOX_TOOLTIP.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index 82c7ff620..a2210e89b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.registry.RegistryWrapper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -33,7 +34,7 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP } @Inject(method = "readNbt", at = @At("RETURN")) - private void restoreCopiedText(NbtCompound nbt, CallbackInfo ci) + private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) { // Restore the copied/pasted text after the TileEntity sync overrides it with empty lines if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue() && this.getWorld() != null && this.getWorld().isClient) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java new file mode 100644 index 000000000..5bc2a6c8e --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java @@ -0,0 +1,23 @@ +package fi.dy.masa.tweakeroo.mixin; + +import fi.dy.masa.tweakeroo.config.Configs; +import net.minecraft.block.enums.TrialSpawnerState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(TrialSpawnerState.class) +public class MixinTrialSpawnerState +{ + @Inject(method = "emitParticles", at = @At("HEAD"), cancellable = true) + private void cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_SPAWNER_PARTICLE.getBooleanValue()) + { + ci.cancel(); + } + } +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java index a24df6f7c..339ac4367 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java @@ -25,7 +25,7 @@ private void disableBlockEntityTicking(CallbackInfo ci) @Inject(method = "tickEntity(Ljava/util/function/Consumer;Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true) private void preventEntityTicking(Consumer consumer, T entityIn, CallbackInfo ci) { - if (Configs.Disable.DISABLE_ENTITY_TICKING.getBooleanValue() && (entityIn instanceof PlayerEntity) == false) + if (Configs.Disable.DISABLE_ENTITY_TICKING.getBooleanValue() && !(entityIn instanceof PlayerEntity)) { ci.cancel(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index 8c96578dd..3f8a7039c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -4,6 +4,7 @@ import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -26,7 +27,9 @@ public abstract class MixinWorldRenderer @Shadow private int cameraChunkX; @Shadow private int cameraChunkZ; + @Unique private int lastUpdatePosX; + @Unique private int lastUpdatePosZ; @Inject(method = "tickRainSplashing", at = @At("HEAD"), cancellable = true) // renderRain @@ -49,7 +52,7 @@ private void cancelRainRender(LightmapTextureManager lightmap, float partialTick @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void preSetupTerrain(net.minecraft.client.util.math.MatrixStack matrixStack, float partialTicks, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer renderer, LightmapTextureManager lightmap, Matrix4f matrix4f, CallbackInfo ci) + private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -59,7 +62,7 @@ private void preSetupTerrain(net.minecraft.client.util.math.MatrixStack matrixSt @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void postSetupTerrain(net.minecraft.client.util.math.MatrixStack matrixStack, float partialTicks, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer renderer, LightmapTextureManager lightmap, Matrix4f matrix4f, CallbackInfo ci) + private void postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 844de5baf..8b5edfe44 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -2,6 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Matrix4f; +import org.joml.Matrix4fStack; import org.joml.Quaternionf; import net.minecraft.block.Block; @@ -11,7 +12,6 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.Camera; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; @@ -95,7 +95,7 @@ public static void renderHotbarSwapOverlay(MinecraftClient mc, DrawContext drawC { ItemStack stack = player.getInventory().getStack(row * 9 + column); - if (stack.isEmpty() == false) + if (!stack.isEmpty()) { fi.dy.masa.malilib.render.InventoryOverlay.renderStackAt(stack, x, y, 1, mc, drawContext); } @@ -292,25 +292,51 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) { MinecraftClient mc = MinecraftClient.getInstance(); + // New Matrix4fStack method int width = GuiUtils.getScaledWindowWidth(); int height = GuiUtils.getScaledWindowHeight(); Camera camera = mc.gameRenderer.getCamera(); - MatrixStack matrixStack = RenderSystem.getModelViewStack(); - matrixStack.push(); - matrixStack.translate(width / 2.0, height / 2.0, zLevel); + //MatrixStack matrixStack = RenderSystem.getModelViewStack(); + //matrixStack.push(); + //matrixStack.translate(width / 2.0, height / 2.0, zLevel); + Matrix4fStack matrixStack = RenderSystem.getModelViewStack(); + matrixStack.pushMatrix(); + matrixStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); float pitch = camera.getPitch(); float yaw = camera.getYaw(); Quaternionf rot = new Quaternionf().rotationXYZ(-pitch * (float) (Math.PI / 180.0), yaw * (float) (Math.PI / 180.0), 0.0F); - matrixStack.multiply(rot); + matrixStack.mul(convertQuaternionToMatrix4f(rot)); //matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(camera.getPitch())); //matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw())); matrixStack.scale(-1.0F, -1.0F, -1.0F); RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); - matrixStack.pop(); + matrixStack.popMatrix(); RenderSystem.applyModelViewMatrix(); } + // Made public under MaLiLib + protected static Matrix4f convertQuaternionToMatrix4f(Quaternionf q) + { + return new Matrix4f( + 1.0f - 2.0f * ( q.y() * q.y() + q.z() * q.z() ), + 2.0f * (q.x() * q.y() + q.z() * q.w()), + 2.0f * (q.x() * q.z() - q.y() * q.w()), + 0.0f, + + 2.0f * ( q.x() * q.y() - q.z() * q.w() ), + 1.0f - 2.0f * ( q.x() * q.x() + q.z() * q.z() ), + 2.0f * (q.z() * q.y() + q.x() * q.w() ), + 0.0f, + + 2.0f * ( q.x() * q.z() + q.y() * q.w() ), + 2.0f * ( q.y() * q.z() - q.x() * q.w() ), + 1.0f - 2.0f * ( q.x() * q.x() + q.y() * q.y() ), + 0.0f, + + 0, 0, 0, 1.0f); + } + public static void notifyRotationChanged() { lastRotationChangeTime = System.currentTimeMillis(); @@ -475,7 +501,7 @@ private static void renderPitchIndicator(int x, int y, int width, int height, fi.dy.masa.malilib.render.RenderUtils.drawRect(x, yCenter + snapThreshOffset, width, 2, 0xFF20FF20); } } - else if (isSnapRange == false) + else if (!isSnapRange) { fi.dy.masa.malilib.render.RenderUtils.drawRect(x + 1, yCenter - 1, width - 2, 2, 0xFFC0C0C0); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index c8f13a822..796e12c7c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -128,6 +128,8 @@ public static void onTick(MinecraftClient mc) public static void onGameLoop(MinecraftClient mc) { + if (mc == null) + return; PlacementTweaks.onTick(mc); // Reset the counters after rendering each frame diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index bc22fbe2a..6ffe10298 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -12,7 +12,7 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; +import net.minecraft.registry.BuiltinRegistries; import net.minecraft.text.TextContent; import net.minecraft.text.TranslatableTextContent; import net.minecraft.util.collection.DefaultedList; @@ -87,7 +87,9 @@ public static ItemStack parseItemFromString(String str) { try { - ItemStringReader.ItemResult itemResult = ItemStringReader.item(Registries.ITEM.getReadOnlyWrapper(), new StringReader(str)); + // This took me like 2 hours to find this for code that is unused + ItemStringReader itemStringReader = new ItemStringReader(BuiltinRegistries.createWrapperLookup()); + ItemStringReader.ItemResult itemResult = itemStringReader.consume(new StringReader(str)); Item item = itemResult.item().value(); if (item != null) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java b/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java index 542481080..4eacfc035 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java @@ -2,5 +2,5 @@ public interface IEntityItem { - int getPickupDelay(); + int tweakeroo$getPickupDelay(); } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index f93f0f46a..e889d98f4 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -1,83 +1,85 @@ { - "required": true, - "package": "fi.dy.masa.tweakeroo.mixin", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_17", - "client": [ - "IMixinAbstractBlock", - "IMixinAbstractHorseEntity", - "IMixinAxeItem", - "IMixinChunkLightProvider", - "IMixinClientWorld", - "IMixinCommandBlockExecutor", - "IMixinShovelItem", - "IMixinSimpleOption", - "MixinAbstractClientPlayerEntity", - "MixinAbstractInventoryScreen", - "MixinAbstractSignEditScreen", - "MixinBackgroundRenderer", - "MixinBatEntity", - "MixinBeaconBlockEntityRenderer", - "MixinBlockEntityRenderDispatcher", - "MixinBlockItem", - "MixinBossBarHud", - "MixinBuiltChunk", - "MixinChatHud", - "MixinChatScreen", - "MixinChunkBuilder_BuiltChunk", - "MixinClientBossBar", - "MixinClientCommandSource", - "MixinClientPlayerEntity", - "MixinClientPlayerInteractionManager", - "MixinClientPlayNetworkHandler", - "MixinClientWorld", - "MixinClientWorld_Properties", - "MixinCloneCommand", - "MixinCommandBlockScreen", - "MixinCreativeInventoryScreen", - "MixinDimensionEffects_Nether", - "MixinEntity", - "MixinEntityRenderDispatcher", - "MixinExplosion", - "MixinFillCommand", - "MixinGameRenderer", - "MixinHeldItemRenderer", - "MixinInGameHud", - "MixinItem", - "MixinItemEntity", - "MixinItemGroup", - "MixinItemStack", - "MixinKeyboardInput", - "MixinLightingProvider", - "MixinLivingEntity", - "MixinMinecraftClient", - "MixinMobSpawnerBlockEntityRenderer", - "MixinMobSpawnerLogic", - "MixinMouse", - "MixinNetherPortalBlock", - "MixinObserverBlock", - "MixinParticleManager", - "MixinPlayerAbilities", - "MixinPlayerEntity", - "MixinRavagerEntity", - "MixinScaffoldingBlock", - "MixinSculkSensor", - "MixinServerPlayNetworkHandler", - "MixinShulkerBoxBlock", - "MixinSignBlockEntity", - "MixinSlimeBlock", - "MixinStructureBlockBlockEntity", - "MixinTeleportSpectatorMenu", - "MixinThreadedAnvilChunkStorage", - "MixinTradeOffer", - "MixinUpdateStructureBlockC2SPacket", - "MixinWindow", - "MixinWorld", - "MixinWorldRenderer" - ], - "mixinPriority": 990, - "injectors": { - "defaultRequire": 0 - }, - "mixins": [] + "required": true, + "package": "fi.dy.masa.tweakeroo.mixin", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_17", + "client": [ + "IMixinAbstractBlock", + "IMixinAbstractHorseEntity", + "IMixinAxeItem", + "IMixinChunkLightProvider", + "IMixinClientWorld", + "IMixinCommandBlockExecutor", + "IMixinShovelItem", + "IMixinSimpleOption", + "MixinAbstractClientPlayerEntity", + "MixinAbstractInventoryScreen", + "MixinAbstractSignEditScreen", + "MixinBackgroundRenderer", + "MixinBatEntity", + "MixinBeaconBlockEntityRenderer", + "MixinBlockEntityRenderDispatcher", + "MixinBlockItem", + "MixinBossBarHud", + "MixinBuiltChunk", + "MixinChatHud", + "MixinChatScreen", + "MixinChunkBuilder_BuiltChunk", + "MixinClientBossBar", + "MixinClientCommandSource", + "MixinClientPlayerEntity", + "MixinClientPlayerInteractionManager", + "MixinClientPlayNetworkHandler", + "MixinClientWorld", + "MixinClientWorld_Properties", + "MixinCloneCommand", + "MixinCommandBlockScreen", + "MixinCreativeInventoryScreen", + "MixinDimensionEffects_Nether", + "MixinEntity", + "MixinEntityRenderDispatcher", + "MixinExplosion", + "MixinFillCommand", + "MixinGameRenderer", + "MixinHeldItemRenderer", + "MixinInGameHud", + "MixinItem", + "MixinItemEntity", + "MixinItemGroup", + "MixinItemStack", + "MixinKeyboardInput", + "MixinLightingProvider", + "MixinLivingEntity", + "MixinMinecraftClient", + "MixinMobSpawnerBlockEntityRenderer", + "MixinMobSpawnerLogic", + "MixinMouse", + "MixinNetherPortalBlock", + "MixinObserverBlock", + "MixinParticleManager", + "MixinPlayerAbilities", + "MixinPlayerEntity", + "MixinRavagerEntity", + "MixinScaffoldingBlock", + "MixinSculkSensor", + "MixinServerPlayNetworkHandler", + "MixinShulkerBoxBlock", + "MixinSignBlockEntity", + "MixinSlimeBlock", + "MixinStructureBlockBlockEntity", + "MixinTeleportSpectatorMenu", + "MixinThreadedAnvilChunkStorage", + "MixinTradeOffer", + "MixinUpdateStructureBlockC2SPacket", + "MixinWindow", + "MixinWorld", + "MixinWorldRenderer" + ], + "mixinPriority": 990, + "injectors": { + "defaultRequire": 0 + }, + "mixins": [ + "MixinTrialSpawnerState" + ] } From 6cfcc9a954cb5702d363a426eae85ace458360e1 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 7 Feb 2024 22:44:16 -0500 Subject: [PATCH 016/128] 24w06a - renderer issues nearly fixed. Still need to check visual rotation values for flexibleBlockPlacement Grid under MaLiLib --- gradle.properties | 8 ++--- .../masa/tweakeroo/event/RenderHandler.java | 9 ++--- .../masa/tweakeroo/renderer/RenderUtils.java | 35 ++++++------------- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9f4aa99c1..de5849779 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w05b -minecraft_version = 24w05b -mappings_version = 24w05b+build.2 +minecraft_version_out = 24w06a +minecraft_version = 24w06a +mappings_version = 24w06a+build.1 fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 -fabric_api_version = 0.95.5+1.20.5 +fabric_api_version = 0.95.6+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 1138c9b06..f3779021e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,6 +1,7 @@ package fi.dy.masa.tweakeroo.event; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.util.math.MatrixStack; import org.joml.Matrix4f; import net.minecraft.client.MinecraftClient; @@ -89,7 +90,7 @@ else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) } @Override - public void onRenderWorldLast(Matrix4f matrix4f, Matrix4f projMatrix) + public void onRenderWorldLast(MatrixStack matrixStack, Matrix4f projMatrix) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -98,11 +99,11 @@ public void onRenderWorldLast(Matrix4f matrix4f, Matrix4f projMatrix) //MatrixStack matrixStack = new MatrixStack(); //matrixStack.multiplyPositionMatrix(matrix4f); - this.renderOverlays(matrix4f, mc); + this.renderOverlays(matrixStack, mc); } } - private void renderOverlays(Matrix4f matrix4f, MinecraftClient mc) + private void renderOverlays(MatrixStack matrixStack, MinecraftClient mc) { Entity entity = mc.getCameraEntity(); @@ -129,7 +130,7 @@ private void renderOverlays(Matrix4f matrix4f, MinecraftClient mc) hitResult.getSide(), hitResult.getPos(), color, - matrix4f, + matrixStack, mc); RenderSystem.enableDepthTest(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 8b5edfe44..5be9d988e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -3,7 +3,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Matrix4f; import org.joml.Matrix4fStack; -import org.joml.Quaternionf; import net.minecraft.block.Block; import net.minecraft.block.ShulkerBoxBlock; @@ -296,18 +295,26 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) int width = GuiUtils.getScaledWindowWidth(); int height = GuiUtils.getScaledWindowHeight(); Camera camera = mc.gameRenderer.getCamera(); + //MatrixStack matrixStack = RenderSystem.getModelViewStack(); //matrixStack.push(); //matrixStack.translate(width / 2.0, height / 2.0, zLevel); + Matrix4fStack matrixStack = RenderSystem.getModelViewStack(); matrixStack.pushMatrix(); matrixStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); float pitch = camera.getPitch(); float yaw = camera.getYaw(); - Quaternionf rot = new Quaternionf().rotationXYZ(-pitch * (float) (Math.PI / 180.0), yaw * (float) (Math.PI / 180.0), 0.0F); - matrixStack.mul(convertQuaternionToMatrix4f(rot)); + + //Quaternionf rot = new Quaternionf().rotationXYZ(-pitch * (float) (Math.PI / 180.0), yaw * (float) (Math.PI / 180.0), 0.0F); + //matrixStack.multiply(rot); //matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(camera.getPitch())); //matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw())); + + matrixStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); + matrixStack.rotateX(-(pitch)); + matrixStack.rotateY(yaw); + matrixStack.scale(-1.0F, -1.0F, -1.0F); RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); @@ -315,28 +322,6 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) RenderSystem.applyModelViewMatrix(); } - // Made public under MaLiLib - protected static Matrix4f convertQuaternionToMatrix4f(Quaternionf q) - { - return new Matrix4f( - 1.0f - 2.0f * ( q.y() * q.y() + q.z() * q.z() ), - 2.0f * (q.x() * q.y() + q.z() * q.w()), - 2.0f * (q.x() * q.z() - q.y() * q.w()), - 0.0f, - - 2.0f * ( q.x() * q.y() - q.z() * q.w() ), - 1.0f - 2.0f * ( q.x() * q.x() + q.z() * q.z() ), - 2.0f * (q.z() * q.y() + q.x() * q.w() ), - 0.0f, - - 2.0f * ( q.x() * q.z() + q.y() * q.w() ), - 2.0f * ( q.y() * q.z() - q.x() * q.w() ), - 1.0f - 2.0f * ( q.x() * q.x() + q.y() * q.y() ), - 0.0f, - - 0, 0, 0, 1.0f); - } - public static void notifyRotationChanged() { lastRotationChangeTime = System.currentTimeMillis(); From b6211d635c2cc70799ab96816dfe39c4db69c78f Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 8 Feb 2024 17:55:11 -0500 Subject: [PATCH 017/128] 24w06a - Matrix4f Renderer methods fixed & fully implemented. --- .../dy/masa/tweakeroo/event/RenderHandler.java | 9 ++++----- .../dy/masa/tweakeroo/renderer/RenderUtils.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index f3779021e..1138c9b06 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,7 +1,6 @@ package fi.dy.masa.tweakeroo.event; import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.util.math.MatrixStack; import org.joml.Matrix4f; import net.minecraft.client.MinecraftClient; @@ -90,7 +89,7 @@ else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) } @Override - public void onRenderWorldLast(MatrixStack matrixStack, Matrix4f projMatrix) + public void onRenderWorldLast(Matrix4f matrix4f, Matrix4f projMatrix) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -99,11 +98,11 @@ public void onRenderWorldLast(MatrixStack matrixStack, Matrix4f projMatrix) //MatrixStack matrixStack = new MatrixStack(); //matrixStack.multiplyPositionMatrix(matrix4f); - this.renderOverlays(matrixStack, mc); + this.renderOverlays(matrix4f, mc); } } - private void renderOverlays(MatrixStack matrixStack, MinecraftClient mc) + private void renderOverlays(Matrix4f matrix4f, MinecraftClient mc) { Entity entity = mc.getCameraEntity(); @@ -130,7 +129,7 @@ private void renderOverlays(MatrixStack matrixStack, MinecraftClient mc) hitResult.getSide(), hitResult.getPos(), color, - matrixStack, + matrix4f, mc); RenderSystem.enableDepthTest(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 5be9d988e..e4b5e4580 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -300,9 +300,9 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) //matrixStack.push(); //matrixStack.translate(width / 2.0, height / 2.0, zLevel); - Matrix4fStack matrixStack = RenderSystem.getModelViewStack(); - matrixStack.pushMatrix(); - matrixStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); + Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); + matrix4fStack.pushMatrix(); + matrix4fStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); float pitch = camera.getPitch(); float yaw = camera.getYaw(); @@ -311,14 +311,14 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) //matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(camera.getPitch())); //matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw())); - matrixStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); - matrixStack.rotateX(-(pitch)); - matrixStack.rotateY(yaw); + matrix4fStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); + matrix4fStack.rotateX(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(-pitch)); + matrix4fStack.rotateY(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(yaw)); - matrixStack.scale(-1.0F, -1.0F, -1.0F); + matrix4fStack.scale(-1.0F, -1.0F, -1.0F); RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); - matrixStack.popMatrix(); + matrix4fStack.popMatrix(); RenderSystem.applyModelViewMatrix(); } From 48f9a7688e6d7e118df8979b6f64acd6e50f3cc8 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 10 Feb 2024 14:57:37 -0500 Subject: [PATCH 018/128] 24w06a - merge from 0.19.1 & 0.19.2, elytra swap fix & map preview required shift --- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 ++ .../dy/masa/tweakeroo/event/RenderHandler.java | 5 +++-- .../dy/masa/tweakeroo/util/InventoryUtils.java | 16 ++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index fe7095c09..e77c87015 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -75,6 +75,7 @@ public static class Generic public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger ("hotbarSwapOverlayOffsetY", 4, "The vertical offset of the hotbar swap overlay"); public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger ("itemSwapDurabilityThreshold", 20, 5, 10000, "This is the durability threshold (in uses left)\nfor the low-durability item swap feature.\nNote that items with low total durability will go lower\nand be swapped at 5%% left."); public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean ("itemUsePacketCheckBypass", true, "Bypass the new distance/coordinate check that was added in 1.18.2.\n\nThat check breaks the \"accurate placement protocol\" and causes\nany blocks placed with a rotation (or other property) request to just become ghost blocks.\n\nThere is basically no need to ever disable this.\nThe check didn't even exist ever before 1.18.2."); + public static final ConfigBoolean MAP_PREVIEW_REQUIRE_SHIFT = new ConfigBoolean ("mapPreviewRequireShift", true, "Whether holding shift is required for the Map Preview"); public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger ("mapPreviewSize", 160, 16, 512, "The size of the rendered map previews"); public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger ("periodicAttackInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic attacks (left clicks)"); public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger ("periodicUseInterval", 20, 0, Integer.MAX_VALUE, "The number of game ticks between automatic uses (right clicks)"); @@ -123,6 +124,7 @@ public static class Generic HAND_RESTOCK_PRE, HANGABLE_ENTITY_BYPASS_INVERSE, ITEM_USE_PACKET_CHECK_BYPASS, + MAP_PREVIEW_REQUIRE_SHIFT, PERMANENT_SNEAK_ALLOW_IN_GUIS, PLACEMENT_RESTRICTION_TIED_TO_FAST, POTION_WARNING_BENEFICIAL_ONLY, diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 1138c9b06..c26155614 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -72,9 +72,10 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, { if (stack.getItem() instanceof FilledMapItem) { - if (FeatureToggle.TWEAK_MAP_PREVIEW.getBooleanValue()) + if (FeatureToggle.TWEAK_MAP_PREVIEW.getBooleanValue() && + (!Configs.Generic.MAP_PREVIEW_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown())) { - fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue()); + fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } } else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 2ed07a2dd..140ef3974 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -820,20 +820,24 @@ else if (hand == Hand.OFF_HAND) } } - private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot type, int sourceSlotNumber) { if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) { - MinecraftClient mc = MinecraftClient.getInstance(); - ScreenHandler container = player.playerScreenHandler; int equipmentSlotNumber = getSlotNumberForEquipmentType(type, player); - int equipmentSlotInvIndex = container.getSlot(equipmentSlotNumber).getIndex(); - - mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, SlotActionType.SWAP, mc.player); + swapSlots(player, sourceSlotNumber, equipmentSlotNumber); } } + public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) + { + MinecraftClient mc = MinecraftClient.getInstance(); + ScreenHandler container = player.currentScreenHandler; + mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); + mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + } + private static void swapToolToHand(int slotNumber, MinecraftClient mc) { PlayerEntity player = mc.player; From 4e42446640b01d747521bb8f9d204b76f57bf43b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 11 Feb 2024 04:23:58 -0500 Subject: [PATCH 019/128] Update gradle.properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index de5849779..461ae52ad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w06a minecraft_version = 24w06a -mappings_version = 24w06a+build.1 +mappings_version = 24w06a+build.7 fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 -fabric_api_version = 0.95.6+1.20.5 +fabric_api_version = 0.96.0+1.20.5 From 23ee7e223c8a069f8ce09e57828176748393c134 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 11 Feb 2024 17:58:34 -0500 Subject: [PATCH 020/128] 24w06a - added option to disable Trial Vault particles --- .../fi/dy/masa/tweakeroo/config/Configs.java | 6 +- .../mixin/MixinTrialSpawnerState.java | 2 +- .../mixin/MixinVaultBlockEntity.java | 59 +++++++++++++++++++ src/main/resources/mixins.tweakeroo.json | 5 +- 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index e77c87015..ec2c779b1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -311,7 +311,8 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_TRIAL_SPAWNER_PARTICLE = new ConfigBooleanClient ("disableTrialSpawnerParticles", false, "", "Removes the particle rendering from trial spawners"); + public static final ConfigBooleanHotkeyed DISABLE_TRIAL_SPAWNER_PARTICLES = new ConfigBooleanClient ("disableTrialSpawnerParticles", false, "", "Removes the particle rendering from trial spawners"); + public static final ConfigBooleanHotkeyed DISABLE_TRIAL_VAULT_PARTICLES = new ConfigBooleanClient ("disableTrialVaultParticles", false, "", "Removes the particle rendering from trial vaults"); public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); @@ -358,7 +359,8 @@ public static class Disable DISABLE_STATUS_EFFECT_HUD, DISABLE_TILE_ENTITY_RENDERING, DISABLE_TILE_ENTITY_TICKING, - DISABLE_TRIAL_SPAWNER_PARTICLE, + DISABLE_TRIAL_SPAWNER_PARTICLES, + DISABLE_TRIAL_VAULT_PARTICLES, DISABLE_VILLAGER_TRADE_LOCKING, DISABLE_WALL_UNSPRINT, DISABLE_WORLD_VIEW_BOB diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java index 5bc2a6c8e..de440ddc3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java @@ -15,7 +15,7 @@ public class MixinTrialSpawnerState @Inject(method = "emitParticles", at = @At("HEAD"), cancellable = true) private void cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) { - if (Configs.Disable.DISABLE_TRIAL_SPAWNER_PARTICLE.getBooleanValue()) + if (Configs.Disable.DISABLE_TRIAL_SPAWNER_PARTICLES.getBooleanValue()) { ci.cancel(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java new file mode 100644 index 000000000..a7fd190f9 --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java @@ -0,0 +1,59 @@ +package fi.dy.masa.tweakeroo.mixin; + +import fi.dy.masa.tweakeroo.config.Configs; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.VaultBlockEntity; +import net.minecraft.block.vault.VaultSharedData; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(VaultBlockEntity.Client.class) +public class MixinVaultBlockEntity +{ + @Inject(method = "spawnActivateParticles", at = @At("HEAD"), cancellable = true) + private static void disable$spawnActivateParticles(World world, BlockPos pos, BlockState state, VaultSharedData sharedData, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) + { + ci.cancel(); + } + } + @Inject(method = "spawnDeactivateParticles", at = @At("HEAD"), cancellable = true) + private static void disable$spawnDeactivateParticles(World world, BlockPos pos, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) + { + ci.cancel(); + } + } + @Inject(method = "spawnAmbientParticles", at = @At("HEAD"), cancellable = true) + private static void disable$spawnAmbientParticles(World world, BlockPos pos, VaultSharedData sharedData, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) + { + ci.cancel(); + } + } + @Inject(method = "spawnConnectedParticlesFor", at = @At("HEAD"), cancellable = true) + private static void disable$spawnConnectedParticlesFor(World world, Vec3d pos, PlayerEntity player, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) + { + ci.cancel(); + } + } + @Inject(method = "spawnConnectedParticles", at = @At("HEAD"), cancellable = true) + private static void disable$spawnConnectedParticles(World world, BlockPos pos, BlockState state, VaultSharedData sharedData, CallbackInfo ci) + { + if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) + { + ci.cancel(); + } + } +} diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index e889d98f4..886ea0cca 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -80,6 +80,7 @@ "defaultRequire": 0 }, "mixins": [ - "MixinTrialSpawnerState" - ] + "MixinTrialSpawnerState", + "MixinVaultBlockEntity" + ] } From d80c681b41c816ee12266fbce50c0bd91ad5a700 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:37:18 -0500 Subject: [PATCH 021/128] 24w06a - some code cleanups --- .../mixin/MixinAbstractSignEditScreen.java | 4 +- .../mixin/MixinBackgroundRenderer.java | 8 ++- .../tweakeroo/mixin/MixinGameRenderer.java | 6 +- .../tweakeroo/mixin/MixinSignBlockEntity.java | 2 +- .../masa/tweakeroo/renderer/RenderUtils.java | 14 ++--- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 4 +- .../tweakeroo/tweaks/PlacementHandler.java | 4 +- .../tweakeroo/tweaks/PlacementTweaks.java | 55 ++++++++++--------- .../dy/masa/tweakeroo/util/CameraEntity.java | 4 +- .../dy/masa/tweakeroo/util/IGuiEditSign.java | 4 +- .../masa/tweakeroo/util/InventoryUtils.java | 22 +++----- .../fi/dy/masa/tweakeroo/util/MiscUtils.java | 2 +- 12 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java index 15cf44b0c..2b72028a5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java @@ -39,7 +39,7 @@ protected MixinAbstractSignEditScreen(Text textComponent) @Shadow @Final private String[] messages; @Override - public SignBlockEntity getTile() + public SignBlockEntity tweakeroo$getTile() { return this.blockEntity; } @@ -78,7 +78,7 @@ private void preventGuiOpen(CallbackInfo ci) } @Override - public void applyText(SignText text) + public void tweakeroo$applyText(SignText text) { this.text = text; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 323e2bdd0..de15adfe4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -2,6 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.Inject; @@ -20,12 +21,13 @@ @Mixin(BackgroundRenderer.class) public abstract class MixinBackgroundRenderer { + @Unique private static boolean wasLava; @ModifyConstant( method = "applyFog", slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/entity/effect/StatusEffect;"), + from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/registry/entry/RegistryEntry;"), to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), constant = @Constant(floatValue = 0.25f), require = 0) @@ -44,7 +46,7 @@ private static float reduceLavaFogStart(float original) @ModifyConstant( method = "applyFog", slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/entity/effect/StatusEffect;"), + from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/registry/entry/RegistryEntry;"), to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), constant = { @Constant(floatValue = 1.0f), @Constant(floatValue = 3.0f)}, require = 0) @@ -112,7 +114,7 @@ private static void disableRenderDistanceFog( { if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) { - if (thickFog == false && wasLava == false) + if (!thickFog && !wasLava) { float distance = Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()); RenderSystem.setShaderFogStart(distance * 1.6F); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index 5c715d818..53f120bd3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -53,7 +53,7 @@ private void onRenderWorld(CallbackInfo ci) target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) private void disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) { - if (Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue() == false) + if (!Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue()) { this.bobView(matrices, tickDelta); } @@ -105,13 +105,13 @@ private Predicate overrideTargetedEntityCheck(Predicate predicat { if (Configs.Disable.DISABLE_DEAD_MOB_TARGETING.getBooleanValue()) { - predicate = predicate.and((entityIn) -> (entityIn instanceof LivingEntity) == false || ((LivingEntity) entityIn).getHealth() > 0f); + predicate = predicate.and((entityIn) -> !(entityIn instanceof LivingEntity) || ((LivingEntity) entityIn).getHealth() > 0f); } if ((FeatureToggle.TWEAK_HANGABLE_ENTITY_BYPASS.getBooleanValue() && this.client.player != null && this.client.player.isSneaking() == Configs.Generic.HANGABLE_ENTITY_BYPASS_INVERSE.getBooleanValue())) { - predicate = predicate.and((entityIn) -> (entityIn instanceof AbstractDecorationEntity) == false); + predicate = predicate.and((entityIn) -> !(entityIn instanceof AbstractDecorationEntity)); } return predicate; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index a2210e89b..d870440d9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -41,7 +41,7 @@ private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup re { MinecraftClient mc = MinecraftClient.getInstance(); - if ((mc.currentScreen instanceof SignEditScreen) && ((IGuiEditSign) mc.currentScreen).getTile() == (Object) this) + if ((mc.currentScreen instanceof SignEditScreen) && ((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) { MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index e4b5e4580..6137f487d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -119,6 +119,7 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo { // We need to get the player from the server world (if available, ie. in single player), // so that the player itself won't be included in the ray trace + assert mc.player != null; Entity serverPlayer = world.getPlayerByUuid(mc.player.getUuid()); if (serverPlayer != null) @@ -237,11 +238,13 @@ public static void renderPlayerInventoryOverlay(MinecraftClient mc, DrawContext fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f); fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, x, y, 9, 27, mc); + assert mc.player != null; fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, mc.player.getInventory(), x + slotOffsetX, y + slotOffsetY, 9, 9, 27, mc, drawContext); } public static void renderHotbarScrollOverlay(MinecraftClient mc, DrawContext drawContext) { + assert mc.player != null; Inventory inv = mc.player.getInventory(); final int xCenter = GuiUtils.getScaledWindowWidth() / 2; final int yCenter = GuiUtils.getScaledWindowHeight() / 2; @@ -291,15 +294,11 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) { MinecraftClient mc = MinecraftClient.getInstance(); - // New Matrix4fStack method int width = GuiUtils.getScaledWindowWidth(); int height = GuiUtils.getScaledWindowHeight(); Camera camera = mc.gameRenderer.getCamera(); - //MatrixStack matrixStack = RenderSystem.getModelViewStack(); - //matrixStack.push(); - //matrixStack.translate(width / 2.0, height / 2.0, zLevel); - + // WorldRenderer changed to Matrix4fStack Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); matrix4fStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); @@ -307,11 +306,9 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) float yaw = camera.getYaw(); //Quaternionf rot = new Quaternionf().rotationXYZ(-pitch * (float) (Math.PI / 180.0), yaw * (float) (Math.PI / 180.0), 0.0F); - //matrixStack.multiply(rot); - //matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(camera.getPitch())); - //matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw())); matrix4fStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); + // Fix rotation values using matrix4fRotateFix() matrix4fStack.rotateX(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(-pitch)); matrix4fStack.rotateY(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(yaw)); @@ -430,6 +427,7 @@ public static void renderPitchLockIndicator(MinecraftClient mc, DrawContext draw int height = 50; int x = xCenter - width / 2; int y = yCenter - height - 10; + assert mc.player != null; double currentPitch = mc.player.getPitch(); double centerPitch = 0; double indicatorRange = 180; diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index 796e12c7c..ca1784a4a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -199,7 +199,7 @@ private static void doPotionWarnings(PlayerEntity player) Collection effects = player.getStatusEffects(); - if (effects.isEmpty() == false) + if (!effects.isEmpty()) { int minDuration = -1; int count = 0; @@ -228,7 +228,7 @@ private static void doPotionWarnings(PlayerEntity player) public static boolean isEntityAllowedByAttackingRestriction(EntityType type) { - if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) + if (!MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type)) { MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN.getOptionListValue(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java index e39a53910..8c6a4d129 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java @@ -43,7 +43,7 @@ else if (decodedFacingIndex >= 0 && decodedFacingIndex <= 5) { facing = Direction.byId(decodedFacingIndex); - if (property.getValues().contains(facing) == false) + if (!property.getValues().contains(facing)) { facing = context.getEntity().getHorizontalFacing().getOpposite(); } @@ -58,7 +58,7 @@ else if (decodedFacingIndex >= 0 && decodedFacingIndex <= 5) BlockPos headPos = context.pos.offset(facing); ItemPlacementContext ctx = context.getItemPlacementContext(); - if (context.getWorld().getBlockState(headPos).canReplace(ctx) == false) + if (!context.getWorld().getBlockState(headPos).canReplace(ctx)) { return null; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 87c5ae667..fc21c8c67 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -64,7 +64,7 @@ public class PlacementTweaks private static Direction sideFirstBreaking = null; private static Direction sideRotatedFirst = null; private static float playerYawFirst; - private static ItemStack[] stackBeforeUse = new ItemStack[] { ItemStack.EMPTY, ItemStack.EMPTY }; + private static final ItemStack[] stackBeforeUse = new ItemStack[] { ItemStack.EMPTY, ItemStack.EMPTY }; private static boolean isFirstClick; private static boolean isEmulatedClick; private static boolean firstWasRotation; @@ -102,20 +102,20 @@ public static void onTick(MinecraftClient mc) stackBeforeUse[1] = ItemStack.EMPTY; } - if (use == false) + if (!use) { clearClickedBlockInfoUse(); // Clear the cached stack when releasing both keys, so that the restock doesn't happen when // using another item or an empty hand. - if (attack == false) + if (!attack) { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } } - if (attack == false) + if (!attack) { clearClickedBlockInfoAttack(); } @@ -128,18 +128,18 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && + !stackOriginal.isEmpty() && canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { - if (isEmulatedClick == false) + if (!isEmulatedClick) { //Tweakeroo.debugLog("onProcessRightClickPre storing stack: %s\n", stackOriginal); cacheStackInHand(hand); } // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on - boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + boolean allowHotbar = !FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() && + !FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue(); InventoryUtils.preRestockHand(player, hand, allowHotbar); } @@ -165,6 +165,7 @@ public static void onLeftClickMousePre() sideFirstBreaking = ((BlockHitResult) trace).getSide(); } + assert mc.player != null; onProcessRightClickPre(mc.player, Hand.MAIN_HAND); } @@ -176,10 +177,11 @@ public static void onLeftClickMousePost() public static void cacheStackInHand(Hand hand) { PlayerEntity player = MinecraftClient.getInstance().player; + assert player != null; ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && + !stackOriginal.isEmpty() && canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { stackBeforeUse[hand.ordinal()] = stackOriginal.copy(); @@ -191,8 +193,9 @@ private static void onAttackTick(MinecraftClient mc) { if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { + assert mc.player != null; if (mc.player.getAbilities().creativeMode || - (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) + (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || !(mc.player.getMainHandStack().getItem() instanceof MiningToolItem))) { final int count = Configs.Generic.FAST_LEFT_CLICK_COUNT.getIntegerValue(); @@ -252,7 +255,7 @@ private static void onUsingTick() ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); if (hand != null && - posNew.equals(posLast) == false && + !posNew.equals(posLast) && canPlaceBlockIntoPosition(world, posNew, ctx) && isPositionAllowedByPlacementRestriction(posNew, side) && canPlaceBlockAgainst(world, pos, player, hand) @@ -357,7 +360,7 @@ public static ActionResult onProcessRightClickBlock( stateClickedOn = state; } - if (canPlaceBlockAgainst(world, posIn, player, hand) == false) + if (!canPlaceBlockAgainst(world, posIn, player, hand)) { return ActionResult.PASS; } @@ -456,7 +459,7 @@ private static ActionResult tryPlaceBlock( boolean simpleOffset = false; - if (handleFlexible == false && + if (!handleFlexible && FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && stack.getItem() instanceof BlockItem) { @@ -478,7 +481,7 @@ private static ActionResult tryPlaceBlock( if (posNew == null) { - if (flexible == false || isFirstClick == false) + if (!flexible || !isFirstClick) { posNew = posIn; } @@ -498,13 +501,13 @@ private static ActionResult tryPlaceBlock( // Pistons, Droppers, Dispensers should face into the block, but Observers should point their back/output // side into the block when the Accurate Placement In hotkey is used - if ((stack.getItem() instanceof BlockItem) == false || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) + if (!(stack.getItem() instanceof BlockItem) || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) { facing = facing.getOpposite(); } //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: %s\n", facing); } - else if (flexible == false || rotation == false) + else if (!flexible || !rotation) { if (stack.getItem() instanceof BlockItem) { @@ -543,7 +546,7 @@ else if (flexible == false || rotation == false) if (accurateReverse) { //Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); - if (accurateIn || flexible == false || rotation == false) + if (accurateIn || !flexible || !rotation) { facing = facing.getOpposite(); } @@ -596,7 +599,7 @@ else if (flexible == false || rotation == false) } } - if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) + if (!isFirstClick && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) { return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, null); } @@ -610,11 +613,11 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt { BlockState state = world.getBlockState(pos); - if (stackClickedOn.isEmpty() == false) + if (!stackClickedOn.isEmpty()) { ItemStack stack = state.getBlock().getPickStack(world, pos, state); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) + if (!fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack)) { return false; } @@ -634,7 +637,7 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt ItemStack stackClicked = state.getBlock().getPickStack(world, pos, state); ItemStack stackHand = player.getStackInHand(hand); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) + if (!fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand)) { return false; } @@ -662,7 +665,7 @@ public static boolean canUseItemWithRestriction(ItemRestriction restriction, Pla private static boolean canUseFastRightClick(PlayerEntity player) { - if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) + if (!canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player)) { return false; } @@ -686,12 +689,12 @@ public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stac { ItemStack stackCurrent = player.getStackInHand(hand); - if (stackOriginal.isEmpty() == false && player.getInventory().selectedSlot == hotbarSlot && - (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) + if (!stackOriginal.isEmpty() && player.getInventory().selectedSlot == hotbarSlot && + (stackCurrent.isEmpty() || !ItemStack.areItemsEqual(stackCurrent, stackOriginal))) { // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on - boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && - FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + boolean allowHotbar = !FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() && + !FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue(); InventoryUtils.restockNewStackToHand(player, hand, stackOriginal, allowHotbar); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java b/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java index 1f92f26a8..9b6556766 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java @@ -41,7 +41,7 @@ public static void movementTick() { CameraEntity camera = getCamera(); - if (camera != null && Configs.Generic.FREE_CAMERA_PLAYER_MOVEMENT.getBooleanValue() == false) + if (camera != null && !Configs.Generic.FREE_CAMERA_PLAYER_MOVEMENT.getBooleanValue()) { GameOptions options = MinecraftClient.getInstance().options; @@ -51,7 +51,7 @@ public static void movementTick() { sprinting = true; } - else if (options.forwardKey.isPressed() == false && options.backKey.isPressed() == false) + else if (!options.forwardKey.isPressed() && !options.backKey.isPressed()) { sprinting = false; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java index 2d979b710..556179d17 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java @@ -5,7 +5,7 @@ public interface IGuiEditSign { - SignBlockEntity getTile(); + SignBlockEntity tweakeroo$getTile(); - void applyText(SignText text); + void tweakeroo$applyText(SignText text); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 140ef3974..732c911fa 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1,11 +1,6 @@ package fi.dy.masa.tweakeroo.util; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -850,7 +845,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; - mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); + Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else { @@ -862,7 +857,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (hotbarSlot != selectedSlot) { inventory.selectedSlot = hotbarSlot; - mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); + Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); @@ -1030,7 +1025,7 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest - if (player.getInventory().getMainHandStack().isEmpty() == false) + if (!player.getInventory().getMainHandStack().isEmpty()) { mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } @@ -1042,7 +1037,7 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s } } - if (slot1.hasStack() == false) + if (!slot1.hasStack()) { break; } @@ -1088,8 +1083,8 @@ public static void switchToPickedBlock() BlockState stateTargeted = world.getBlockState(pos); ItemStack stack = stateTargeted.getBlock().getPickStack(world, pos, stateTargeted); - if (stack.isEmpty() == false && - fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) + if (!stack.isEmpty() && + !fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack())) { ScreenHandler container = player.currentScreenHandler; PlayerInventory inventory = player.getInventory(); @@ -1108,6 +1103,7 @@ public static void switchToPickedBlock() if (isCreative) { inventory.addPickBlock(stack); + assert mc.interactionManager != null; mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); } else @@ -1136,7 +1132,7 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) NbtCompound tag = nbt.getCompound("BlockEntityTag"); if (tag.contains("Items", Constants.NBT.TAG_LIST) && - tag.getList("Items", Constants.NBT.TAG_COMPOUND).size() == 0) + tag.getList("Items", Constants.NBT.TAG_COMPOUND).isEmpty()) { tag.remove("Items"); changed = true; diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java index a040b2a14..ba7136060 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java @@ -275,7 +275,7 @@ public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable Abstrac te.setText(previousSignText, front); if (guiLines != null) { - ((IGuiEditSign) guiLines).applyText(previousSignText); + ((IGuiEditSign) guiLines).tweakeroo$applyText(previousSignText); } } } From 3f002fe1ab7c5febf98554bdc74307e8a5b00f9e Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 13 Feb 2024 04:32:21 -0500 Subject: [PATCH 022/128] 24w06a - remove lame Trial spawner / vault particle rules and cleaned up some wording for the Block / Entity reach overrides with the Single Player warnings. --- .../fi/dy/masa/tweakeroo/config/Configs.java | 8 +-- .../masa/tweakeroo/config/FeatureToggle.java | 4 +- .../masa/tweakeroo/mixin/MixinBlockItem.java | 2 +- .../mixin/MixinCommandBlockScreen.java | 8 ++- .../fi/dy/masa/tweakeroo/mixin/MixinItem.java | 2 +- .../masa/tweakeroo/mixin/MixinItemStack.java | 2 +- .../mixin/MixinTrialSpawnerState.java | 23 -------- .../mixin/MixinVaultBlockEntity.java | 59 ------------------- .../masa/tweakeroo/util/IItemStackLimit.java | 2 +- src/main/resources/mixins.tweakeroo.json | 5 +- 10 files changed, 16 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java delete mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index ec2c779b1..6e47ce6bb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -37,7 +37,7 @@ public class Configs implements IConfigHandler public static class Generic { public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); @@ -48,7 +48,7 @@ public static class Generic public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the\noverride tweak is enabled.\nThe maximum the server allows is 64, and can be set via game rules."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); @@ -311,8 +311,6 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "Disables the status effect HUD rendering (which is usually\nin the top right corner of the screen)"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "Prevents all TileEntity renderers from rendering"); public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); - public static final ConfigBooleanHotkeyed DISABLE_TRIAL_SPAWNER_PARTICLES = new ConfigBooleanClient ("disableTrialSpawnerParticles", false, "", "Removes the particle rendering from trial spawners"); - public static final ConfigBooleanHotkeyed DISABLE_TRIAL_VAULT_PARTICLES = new ConfigBooleanClient ("disableTrialVaultParticles", false, "", "Removes the particle rendering from trial vaults"); public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); @@ -359,8 +357,6 @@ public static class Disable DISABLE_STATUS_EFFECT_HUD, DISABLE_TILE_ENTITY_RENDERING, DISABLE_TILE_ENTITY_TICKING, - DISABLE_TRIAL_SPAWNER_PARTICLES, - DISABLE_TRIAL_VAULT_PARTICLES, DISABLE_VILLAGER_TRADE_LOCKING, DISABLE_WALL_UNSPRINT, DISABLE_WORLD_VIEW_BOB diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 1a92a9b7c..7b17bd5a2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -22,7 +22,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable blockReachDistance"), + TWEAK_BLOCK_REACH_OVERRIDE ("tweakBlockReachOverride", false, true, "", "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"), TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."), TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."), TWEAK_BREAKING_RESTRICTION ("tweakBreakingRestriction", false, "", "Enables the Breaking Restriction mode\n (Plane, Layer, Face, Column, Line, Diagonal).\nBasically only allows you to break blocks\nin those patterns, while holding down the attack key."), @@ -37,7 +37,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable flyDecelerationRampValue"), TWEAK_CUSTOM_INVENTORY_GUI_SCALE("tweakCustomInventoryScreenScale", false, "", "Allows using a custom GUI scale for any inventory screen.\nSee Generic -> §ecustomInventoryGuiScale§r for the scale value"), TWEAK_ELYTRA_CAMERA ("tweakElytraCamera", false, "", "Allows locking the real player rotations while holding the 'elytraCamera' activation key.\nThe controls will then only affect the separate 'camera rotations' for the rendering/camera.\nMeant for things like looking down/around while elytra flying nice and straight."), - TWEAK_ENTITY_REACH_OVERRIDE ("tweakEntityReachOverride", false, "", "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), + TWEAK_ENTITY_REACH_OVERRIDE ("tweakEntityReachOverride", false, true, "", "Overrides the entity reach distance with\nthe one set in Generic -> entityReachDistance"), TWEAK_ENTITY_TYPE_ATTACK_RESTRICTION("tweakEntityTypeAttackRestriction",false, "", "Restricts which entities you are able to attack (manually).\nSee the corresponding 'entityAttackRestriction*' configs in the Lists category."), TWEAK_SHULKERBOX_STACKING ("tweakEmptyShulkerBoxesStack", false, true, "", "Enables empty Shulker Boxes stacking up to 64.\nNOTE: They will also stack inside inventories!\nOn servers this will cause desyncs/glitches\nunless the server has a mod that does the same.\nIn single player this changes shulker box based system behaviour."), TWEAK_SHULKERBOX_STACK_GROUND ("tweakEmptyShulkerBoxesStackOnGround", false, true, "", "Enables empty Shulker Boxes stacking up to 64\nwhen as items on the ground"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index 356d89b9c..d162ca3f3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -68,7 +68,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx */ @Override - public int getMaxStackSize(ItemStack stack) + public int tweakeroo$getMaxStackSize(ItemStack stack) { if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java index 5576e4870..04ddac3c5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java @@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -34,9 +35,13 @@ public abstract class MixinCommandBlockScreen extends AbstractCommandBlockScreen @Shadow private CyclingButtonWidget conditionalModeButton; @Shadow private CyclingButtonWidget redstoneTriggerButton; + @Unique private TextFieldWidget textFieldName; + @Unique private CyclingButtonWidget buttonUpdateExec; + @Unique private boolean updateExecValue; + @Unique private String lastName = ""; @Inject(method = "init", at = @At("RETURN")) @@ -111,7 +116,7 @@ public void tick() { String currentName = this.blockEntity.getCommandExecutor().getCustomName().getString(); - if (currentName.equals(this.lastName) == false) + if (!currentName.equals(this.lastName)) { this.textFieldName.setText(currentName); this.lastName = currentName; @@ -149,6 +154,7 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float partia } } + @Unique private static Text getDisplayStringForCurrentStatus(boolean updateExecValue) { String translationKey = "tweakeroo.gui.button.misc.command_block.update_execution"; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index 2ab75b760..68edb9279 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -10,7 +10,7 @@ public abstract class MixinItem implements IItemStackLimit @Shadow public int getMaxCount() { return 0; } @Override - public int getMaxStackSize(net.minecraft.item.ItemStack stack) + public int tweakeroo$getMaxStackSize(net.minecraft.item.ItemStack stack) { return this.getMaxCount(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index 3e95230d1..0063b9696 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -18,6 +18,6 @@ public abstract class MixinItemStack @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) { - ci.setReturnValue(((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this)); + ci.setReturnValue(((IItemStackLimit) this.getItem()).tweakeroo$getMaxStackSize((ItemStack) (Object) this)); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java deleted file mode 100644 index de440ddc3..000000000 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTrialSpawnerState.java +++ /dev/null @@ -1,23 +0,0 @@ -package fi.dy.masa.tweakeroo.mixin; - -import fi.dy.masa.tweakeroo.config.Configs; -import net.minecraft.block.enums.TrialSpawnerState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(TrialSpawnerState.class) -public class MixinTrialSpawnerState -{ - @Inject(method = "emitParticles", at = @At("HEAD"), cancellable = true) - private void cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_SPAWNER_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } -} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java deleted file mode 100644 index a7fd190f9..000000000 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinVaultBlockEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -package fi.dy.masa.tweakeroo.mixin; - -import fi.dy.masa.tweakeroo.config.Configs; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.VaultBlockEntity; -import net.minecraft.block.vault.VaultSharedData; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(VaultBlockEntity.Client.class) -public class MixinVaultBlockEntity -{ - @Inject(method = "spawnActivateParticles", at = @At("HEAD"), cancellable = true) - private static void disable$spawnActivateParticles(World world, BlockPos pos, BlockState state, VaultSharedData sharedData, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } - @Inject(method = "spawnDeactivateParticles", at = @At("HEAD"), cancellable = true) - private static void disable$spawnDeactivateParticles(World world, BlockPos pos, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } - @Inject(method = "spawnAmbientParticles", at = @At("HEAD"), cancellable = true) - private static void disable$spawnAmbientParticles(World world, BlockPos pos, VaultSharedData sharedData, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } - @Inject(method = "spawnConnectedParticlesFor", at = @At("HEAD"), cancellable = true) - private static void disable$spawnConnectedParticlesFor(World world, Vec3d pos, PlayerEntity player, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } - @Inject(method = "spawnConnectedParticles", at = @At("HEAD"), cancellable = true) - private static void disable$spawnConnectedParticles(World world, BlockPos pos, BlockState state, VaultSharedData sharedData, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_TRIAL_VAULT_PARTICLES.getBooleanValue()) - { - ci.cancel(); - } - } -} diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java index 62a4ad177..1649349ff 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java @@ -4,5 +4,5 @@ public interface IItemStackLimit { - int getMaxStackSize(ItemStack stack); + int tweakeroo$getMaxStackSize(ItemStack stack); } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index 886ea0cca..4b00d438b 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -79,8 +79,5 @@ "injectors": { "defaultRequire": 0 }, - "mixins": [ - "MixinTrialSpawnerState", - "MixinVaultBlockEntity" - ] + "mixins": [] } From 7515d6e1e8add837df780fb5931ed1118d6e4a77 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 14 Feb 2024 15:41:25 -0500 Subject: [PATCH 023/128] 24w07a - some mixin target fixes --- gradle.properties | 8 ++--- .../masa/tweakeroo/mixin/MixinBlockItem.java | 2 +- .../masa/tweakeroo/mixin/MixinChatScreen.java | 9 ++++-- .../mixin/MixinClientCommandSource.java | 3 ++ .../mixin/MixinClientPlayerEntity.java | 4 +++ .../mixin/MixinCommandBlockScreen.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinEntity.java | 4 +++ .../masa/tweakeroo/mixin/MixinExplosion.java | 30 ++++++++++++------- .../tweakeroo/mixin/MixinSignBlockEntity.java | 2 +- .../masa/tweakeroo/util/ISignTextAccess.java | 2 +- .../fi/dy/masa/tweakeroo/util/MiscUtils.java | 2 +- 11 files changed, 45 insertions(+), 23 deletions(-) diff --git a/gradle.properties b/gradle.properties index 461ae52ad..ebef44401 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w06a -minecraft_version = 24w06a -mappings_version = 24w06a+build.7 +minecraft_version_out = 24w07a +minecraft_version = 24w07a +mappings_version = 24w07a+build.1 fabric_loader_version = 0.15.6 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.0+1.20.5 +fabric_api_version = 0.96.1+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index d162ca3f3..8cc015611 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -72,7 +72,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx { if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && - InventoryUtils.shulkerBoxHasItems(stack) == false) + !InventoryUtils.shulkerBoxHasItems(stack)) { return 64; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java index a2f18b5f8..0cbb81d5a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java @@ -35,7 +35,7 @@ private void storeChatText(CallbackInfo ci) @Inject(method = "(Ljava/lang/String;)V", at = @At("RETURN")) private void restoreText(String defaultText, CallbackInfo ci) { - if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && MiscUtils.getLastChatText().isEmpty() == false) + if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && !MiscUtils.getLastChatText().isEmpty()) { this.originalChatText = MiscUtils.getLastChatText(); } @@ -43,8 +43,11 @@ private void restoreText(String defaultText, CallbackInfo ci) @Inject(method = "keyPressed(III)Z", slice = @Slice( - from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatScreen;sendMessage(Ljava/lang/String;Z)Z")), - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = Shift.AFTER)) + from = @At(value = "INVOKE", + target = "Lnet/minecraft/client/gui/screen/ChatScreen;sendMessage(Ljava/lang/String;Z)V")), + at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", + shift = Shift.AFTER)) private void onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) { MiscUtils.setLastChatText(""); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java index b59a381fc..bdff5c479 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.Locale; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -42,11 +43,13 @@ private void onGetPositionSuggestions(CallbackInfoReturnable_> + // This is needed because otherwise, the name updating is delayed by "one GUI opening" >_> @Override public void tick() { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index b7e14ffef..f2de467fd 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -2,6 +2,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -22,7 +23,9 @@ public abstract class MixinEntity @Shadow public float prevYaw; @Shadow public float prevPitch; + @Unique private double forcedPitch; + @Unique private double forcedYaw; @Shadow public abstract net.minecraft.util.math.Vec3d getVelocity(); @@ -135,6 +138,7 @@ private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) } } + @Unique private void updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) { if (updateYaw) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java index 09549c1ae..c0f56ec54 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java @@ -1,10 +1,9 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.particle.ParticleEffect; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.Slice; -import net.minecraft.particle.DefaultParticleType; +import org.spongepowered.asm.mixin.injection.ModifyArg; import net.minecraft.particle.ParticleTypes; import net.minecraft.world.explosion.Explosion; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -12,14 +11,13 @@ @Mixin(Explosion.class) public abstract class MixinExplosion { - @Redirect(method = "affectWorld", - slice = @Slice( - from = @At("HEAD"), - to = @At(value = "FIELD", - target = "Lnet/minecraft/world/explosion/Explosion;affectedBlocks:Lit/unimi/dsi/fastutil/objects/ObjectArrayList;")), - at = @At(value = "FIELD", - target = "Lnet/minecraft/particle/ParticleTypes;EXPLOSION_EMITTER:Lnet/minecraft/particle/DefaultParticleType;")) - private DefaultParticleType redirectSpawnParticles() + /** + * I don't know how long this was broken (1.20.4 also?), but let's try to fix it. + */ + @ModifyArg(method = "affectWorld", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V")) + private ParticleEffect addParticleModify(ParticleEffect parameters) { if (FeatureToggle.TWEAK_EXPLOSION_REDUCED_PARTICLES.getBooleanValue()) { @@ -28,4 +26,14 @@ private DefaultParticleType redirectSpawnParticles() return ParticleTypes.EXPLOSION_EMITTER; } + } +/* +@Redirect(method = "affectWorld", + slice = @Slice( + from = @At("HEAD"), + to = @At(value = "FIELD", + target = "Lnet/minecraft/world/explosion/Explosion;affectedBlocks:Lit/unimi/dsi/fastutil/objects/ObjectArrayList;")), + at = @At(value = "FIELD", + target = "Lnet/minecraft/particle/ParticleTypes;EXPLOSION_EMITTER:Lnet/minecraft/particle/DefaultParticleType;")) + */ \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index d870440d9..71467501e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -49,7 +49,7 @@ private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup re } @Override - public SignText getText(boolean front) + public SignText tweakeroo$getText(boolean front) { return front ? this.frontText : this.backText; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java index 02e5ef45c..9c4c2fb93 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java @@ -4,5 +4,5 @@ public interface ISignTextAccess { - SignText getText(boolean front); + SignText tweakeroo$getText(boolean front); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java index ba7136060..0352fdc7a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java @@ -265,7 +265,7 @@ public static int getChatBackgroundColor(int colorOrig) public static void copyTextFromSign(SignBlockEntity te, boolean front) { - previousSignText = ((ISignTextAccess) te).getText(front); + previousSignText = ((ISignTextAccess) te).tweakeroo$getText(front); } public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable AbstractSignEditScreen guiLines, boolean front) From 14507f6536cd89bb2a1660f89a82e93a3dd610b2 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:52:36 -0500 Subject: [PATCH 024/128] 24w07a - some debug loggers enabled to debug clicking issues for issue # 485 -- Mac Mouse / Trackpad issue from 0.16.1/3 + ? --- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 +- .../masa/tweakeroo/config/FeatureToggle.java | 2 +- .../tweakeroo/tweaks/PlacementTweaks.java | 34 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 6e47ce6bb..28096f762 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -278,7 +278,7 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "Disables boss bar rendering"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "Disables all client-side light updates"); public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 7b17bd5a2..5f22d13c5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -69,7 +69,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable periodicAttackInterval"), TWEAK_PERIODIC_USE ("tweakPeriodicUse", false, "", "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"), TWEAK_PERIODIC_HOLD_ATTACK ("tweakPeriodicHoldAttack", false, "", "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"), - TWEAK_PERIODIC_HOLD_USE ("tweakPeriodicHoldUse", false, "", "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), + TWEAK_PERIODIC_HOLD_USE ("tweakPeriodicHoldUse", false, "", "Enables periodically holding use for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldUseInterval\nand the duration in periodicHoldUseDuration\n§6Note: You should not use the normal hold use\n§6or the periodic use at the same time"), TWEAK_PERMANENT_SNEAK ("tweakPermanentSneak", false, "", "If enabled, the player will be sneaking the entire time"), TWEAK_PERMANENT_SPRINT ("tweakPermanentSprint", false, "", "If enabled, the player will be always sprinting when moving forward"), TWEAK_PLACEMENT_GRID ("tweakPlacementGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only place blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."), diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index fc21c8c67..4f478d935 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -133,7 +133,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { if (!isEmulatedClick) { - //Tweakeroo.debugLog("onProcessRightClickPre storing stack: %s\n", stackOriginal); + Tweakeroo.debugLog("onProcessRightClickPre storing stack: {}", stackOriginal); cacheStackInHand(hand); } @@ -148,7 +148,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { - //Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); + Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: {}, current: {}", stackBeforeUse[hand.ordinal()], player.getStackInHand(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } @@ -365,7 +365,7 @@ public static ActionResult onProcessRightClickBlock( return ActionResult.PASS; } - //Tweakeroo.debugLog("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); + Tweakeroo.debugLog("onProcessRightClickBlock() pos: {}, side: {}, part: {}, hitVec: {}", posIn, sideIn, hitPart, hitVec); ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); // Store the initial click data for the fast placement mode @@ -391,7 +391,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - //Tweakeroo.debugLog("plop store @ %s\n", posFirst); + Tweakeroo.debugLog("plop store @ {}", posFirst); } return result; @@ -505,7 +505,7 @@ private static ActionResult tryPlaceBlock( { facing = facing.getOpposite(); } - //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: %s\n", facing); + Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: {}", facing); } else if (!flexible || !rotation) { @@ -530,7 +530,7 @@ else if (!flexible || !rotation) } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - //Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); + Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: {}, state: {}, hit: {}, posIn: {}, posNew: {}", sideIn, state, hitVec, posIn, posNew); if (facingTmp != null) { @@ -545,7 +545,7 @@ else if (!flexible || !rotation) if (accurateReverse) { - //Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); + Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: {}, facingNew: {}", facing, facing.getOpposite()); if (accurateIn || !flexible || !rotation) { facing = facing.getOpposite(); @@ -572,13 +572,13 @@ else if (!flexible || !rotation) x += afterClickerClickCount * 16; } - //Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: %s\n", hitVec); - //Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); + Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: {}", hitVec); + Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: {}, x: {}, posNew: {}, side: {}", facing, x, posNew, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - //Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: %s\n", hitVec); + Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: {}", hitVec); } - //Tweakeroo.debugLog("PlacementTweaks#accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); + Tweakeroo.debugLog("PlacementTweaks#accurate - facing: {}, side: {}, posNew: {}, hit: {}", facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } @@ -590,7 +590,7 @@ else if (!flexible || !rotation) if (canPlaceBlockIntoPosition(world, posNew, ctx)) { // Re-enable Debug logging for now - Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s", posNew, side, hitPart, hitVec); + Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: {}, side: {}, part: {}, hitVec: {}", posNew, side, hitPart, hitVec); return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); } else @@ -784,7 +784,7 @@ private static ActionResult processRightClickBlockWrapper( x += afterClickerClickCount * 16; } - //Tweakeroo.debugLog("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); + Tweakeroo.debugLog("processRightClickBlockWrapper req facing: {}, x: {}, pos: {}, sideIn: {}", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } @@ -807,7 +807,7 @@ private static ActionResult processRightClickBlockWrapper( InventoryUtils.trySwapCurrentToolIfNearlyBroken(); - //Tweakeroo.debugLog("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); + //Tweakeroo.debugLog("processRightClickBlockWrapper() pos:{}, side: {}, hitVec: {}", pos, side, hitVec); ActionResult result; if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) @@ -828,7 +828,7 @@ private static ActionResult processRightClickBlockWrapper( // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - //Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); + Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: {}, current: {}", stackOriginal, player.getStackInHand(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && @@ -837,7 +837,7 @@ private static ActionResult processRightClickBlockWrapper( { for (int i = 0; i < afterClickerClickCount; i++) { - //Tweakeroo.debugLog("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); + //Tweakeroo.debugLog("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s", i, pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posPlacement, false); result = controller.interactBlock(player, hand, context); } @@ -900,7 +900,7 @@ else if (hitPart == HitPart.RIGHT) player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - //Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); + Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: {}, side: {}, facing orig: yaw: {} / pitch: {} facing new: {}", pos, side, yaw, pitch, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); From 9a860fc899c2dc38dd33d26f424a6b8ead990935 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 15 Feb 2024 12:07:24 -0500 Subject: [PATCH 025/128] 24w07a - added debuggers for tweakFastBlockPlacement workflow --- src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java | 2 +- .../java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java index c0f56ec54..4b04c590d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java @@ -12,7 +12,7 @@ public abstract class MixinExplosion { /** - * I don't know how long this was broken (1.20.4 also?), but let's try to fix it. + * I don't know how long this was broken (1.20.4 also?), but let's fix it. */ @ModifyArg(method = "affectWorld", at = @At(value = "INVOKE", diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 4f478d935..e9c5bd843 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -254,6 +254,7 @@ private static void onUsingTick() hitResult = new BlockHitResult(hitVec, side, posNew, false); ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); + Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, side {} pos {} hitResult {}, posNew {}, posLast {}", side, pos, hitResult, posNew, posLast); if (hand != null && !posNew.equals(posLast) && canPlaceBlockIntoPosition(world, posNew, ctx) && @@ -277,6 +278,8 @@ private static void onUsingTick() ActionResult result = tryPlaceBlock(mc.interactionManager, player, mc.world, posNew, sideFirst, sideRotatedFirst, playerYawFirst, hitVec, hand, hitPartFirst, false); + Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, tryPlaceBlock: hitVec {} result {}", hitVec, result); + if (result == ActionResult.SUCCESS) { posLast = posNew; @@ -302,6 +305,8 @@ else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && { final int count = Configs.Generic.FAST_RIGHT_CLICK_COUNT.getIntegerValue(); + Tweakeroo.debugLog("onUsingTick(): fastRightClick, count {} ", count); + for (int i = 0; i < count; ++i) { isEmulatedClick = true; From bd0d50959cb6b747daeece26817ed6388f170cad Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:19:27 -0500 Subject: [PATCH 026/128] 24w07a - api / loom version bump --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index ebef44401..314af4375 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w07a minecraft_version = 24w07a -mappings_version = 24w07a+build.1 +mappings_version = 24w07a+build.7 -fabric_loader_version = 0.15.6 +fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.1+1.20.5 +fabric_api_version = 0.96.3+1.20.5 From 59765518c2d0001d22024ca2843541b3f95ae19d Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 28 Feb 2024 18:23:29 -0500 Subject: [PATCH 027/128] 24w09a basic --- gradle.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 314af4375..ae8f00ed0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w07a -minecraft_version = 24w07a -mappings_version = 24w07a+build.7 +minecraft_version_out = 24w09a +minecraft_version = 24w09a +mappings_version = 24w09a+build.3 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.3+1.20.5 +fabric_api_version = 0.96.4+1.20.5 From a6bf4c97abdbb3abe119b49a9c13c507be114493 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 29 Feb 2024 02:07:57 -0500 Subject: [PATCH 028/128] 24w09a - mostly works, check the Shulker Box Preview code yet. --- .../tweakeroo/util/CreativeExtraItems.java | 11 ++- .../masa/tweakeroo/util/InventoryUtils.java | 75 +++++++++++++++---- 2 files changed, 67 insertions(+), 19 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index 6ffe10298..9ada3f252 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -6,6 +6,7 @@ import com.google.common.collect.ArrayListMultimap; import com.mojang.brigadier.StringReader; import net.minecraft.block.InfestedBlock; +import net.minecraft.class_9323; import net.minecraft.command.argument.ItemStringReader; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; @@ -69,9 +70,10 @@ private static void setCreativeExtraItems(ItemGroup group, List items) { ItemStack stack = parseItemFromString(str); - if (stack.isEmpty() == false) + if (!stack.isEmpty()) { - if (stack.hasNbt()) + //if (stack.hasNbt()) + if (stack.method_57353().method_57835() > 0) { ADDED_ITEMS.put(group, stack); } @@ -94,8 +96,11 @@ public static ItemStack parseItemFromString(String str) if (item != null) { + // FIXME class_9323 == DataComponentMap under Mojang Mappings + class_9323 components = item.method_57347(); ItemStack stack = new ItemStack(item); - stack.setNbt(itemResult.nbt()); + //stack.setNbt(itemResult.nbt()); + stack.method_57365(components); return stack; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 732c911fa..25db6da5a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -7,12 +7,17 @@ import javax.annotation.Nullable; import net.minecraft.block.BlockState; +import net.minecraft.class_9285; +import net.minecraft.class_9288; +import net.minecraft.class_9323; +import net.minecraft.class_9334; import net.minecraft.client.MinecraftClient; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ArmorItem; @@ -23,7 +28,6 @@ import net.minecraft.item.MiningToolItem; import net.minecraft.item.SwordItem; import net.minecraft.item.ToolItem; -import net.minecraft.nbt.NbtCompound; import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket; import net.minecraft.registry.Registries; import net.minecraft.screen.PlayerScreenHandler; @@ -40,7 +44,6 @@ import net.minecraft.world.World; import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.Constants; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; import fi.dy.masa.tweakeroo.Tweakeroo; @@ -445,17 +448,36 @@ private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previous private static float getBaseAttackDamage(ItemStack stack) { Item item = stack.getItem(); + class_9323 data = stack.method_57353(); - if (item instanceof SwordItem) + if (data != null && data.method_57832(class_9334.ATTRIBUTE_MODIFIERS)) { - return ((SwordItem) item).getAttackDamage(); - } - else if (item instanceof MiningToolItem) - { - return ((MiningToolItem) item).getAttackDamage(); - } + class_9285 itemAttribute = data.method_57829(class_9334.ATTRIBUTE_MODIFIERS); + if (itemAttribute != null) + { + List modifiers = itemAttribute.modifiers(); - return 0F; + for (class_9285.class_9287 entry : modifiers) + { + if (entry.attribute().equals(EntityAttributes.GENERIC_ATTACK_DAMAGE)) + { + if (item instanceof SwordItem) + { + return (float) entry.modifier().getValue(); + } + else if (item instanceof MiningToolItem) + { + return (float) entry.modifier().getValue(); + } + } + } + return 0F; + } + else + return 0F; + } + else + return 0F; } protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) @@ -1123,10 +1145,34 @@ public static void switchToPickedBlock() public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { boolean changed = false; - NbtCompound nbt = stack.getNbt(); + //NbtCompound nbt = stack.getNbt(); + class_9323 data = stack.method_57353(); - if (nbt != null) + if (data != null && data.method_57832(class_9334.CONTAINER)) { + class_9288 itemContainer = data.method_57829(class_9334.CONTAINER); + + if (itemContainer != null) + { + //DefaultedList items = DefaultedList.of(); + Iterator iter = itemContainer.iterator(); + //long size = itemContainer.method_57489().count(); + + while (iter.hasNext()) + { + ItemStack item = iter.next(); + if (item.isEmpty()) + { + iter.remove(); + changed = true; + } + } + } + } + + return changed; + } + /* if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) { NbtCompound tag = nbt.getCompound("BlockEntityTag"); @@ -1149,8 +1195,5 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) stack.setNbt(null); changed = true; } - } - - return changed; - } + */ } From 969bba3047742c3b50373c53219743273cdb7ad6 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 29 Feb 2024 11:15:31 -0500 Subject: [PATCH 029/128] 24w09a -- loom build 5 --- gradle.properties | 2 +- .../tweakeroo/util/CreativeExtraItems.java | 12 ++++----- .../masa/tweakeroo/util/InventoryUtils.java | 27 +++++++++---------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/gradle.properties b/gradle.properties index ae8f00ed0..cd98b574f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w09a minecraft_version = 24w09a -mappings_version = 24w09a+build.3 +mappings_version = 24w09a+build.5 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index 9ada3f252..7fe0238fb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -6,8 +6,8 @@ import com.google.common.collect.ArrayListMultimap; import com.mojang.brigadier.StringReader; import net.minecraft.block.InfestedBlock; -import net.minecraft.class_9323; import net.minecraft.command.argument.ItemStringReader; +import net.minecraft.component.ComponentMap; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; @@ -72,8 +72,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) if (!stack.isEmpty()) { - //if (stack.hasNbt()) - if (stack.method_57353().method_57835() > 0) + if (!stack.getComponents().isEmpty()) { ADDED_ITEMS.put(group, stack); } @@ -96,11 +95,10 @@ public static ItemStack parseItemFromString(String str) if (item != null) { - // FIXME class_9323 == DataComponentMap under Mojang Mappings - class_9323 components = item.method_57347(); + ComponentMap components = item.getComponents(); ItemStack stack = new ItemStack(item); - //stack.setNbt(itemResult.nbt()); - stack.method_57365(components); + + stack.copyComponentsFrom(components); return stack; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 25db6da5a..343917041 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -7,11 +7,11 @@ import javax.annotation.Nullable; import net.minecraft.block.BlockState; -import net.minecraft.class_9285; -import net.minecraft.class_9288; -import net.minecraft.class_9323; -import net.minecraft.class_9334; import net.minecraft.client.MinecraftClient; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.AttributeModifiersComponent; +import net.minecraft.component.type.ContainerComponent; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; @@ -448,16 +448,16 @@ private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previous private static float getBaseAttackDamage(ItemStack stack) { Item item = stack.getItem(); - class_9323 data = stack.method_57353(); + ComponentMap data = stack.getComponents(); - if (data != null && data.method_57832(class_9334.ATTRIBUTE_MODIFIERS)) + if (data != null && data.contains(DataComponentTypes.ATTRIBUTE_MODIFIERS)) { - class_9285 itemAttribute = data.method_57829(class_9334.ATTRIBUTE_MODIFIERS); + AttributeModifiersComponent itemAttribute = data.get(DataComponentTypes.ATTRIBUTE_MODIFIERS); if (itemAttribute != null) { - List modifiers = itemAttribute.modifiers(); + List modifiers = itemAttribute.modifiers(); - for (class_9285.class_9287 entry : modifiers) + for (AttributeModifiersComponent.Entry entry : modifiers) { if (entry.attribute().equals(EntityAttributes.GENERIC_ATTACK_DAMAGE)) { @@ -1145,18 +1145,15 @@ public static void switchToPickedBlock() public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { boolean changed = false; - //NbtCompound nbt = stack.getNbt(); - class_9323 data = stack.method_57353(); + ComponentMap data = stack.getComponents(); - if (data != null && data.method_57832(class_9334.CONTAINER)) + if (data != null && data.contains(DataComponentTypes.CONTAINER)) { - class_9288 itemContainer = data.method_57829(class_9334.CONTAINER); + ContainerComponent itemContainer = data.get(DataComponentTypes.CONTAINER); if (itemContainer != null) { - //DefaultedList items = DefaultedList.of(); Iterator iter = itemContainer.iterator(); - //long size = itemContainer.method_57489().count(); while (iter.hasNext()) { From cb53decb0a421b8830952a6f485e7776e6e40e0c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 29 Feb 2024 23:33:24 -0500 Subject: [PATCH 030/128] 24w09a - loom build 6 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cd98b574f..f1036810a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w09a minecraft_version = 24w09a -mappings_version = 24w09a+build.5 +mappings_version = 24w09a+build.6 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 From 4ed957031a4870ef7c0112da403cb812f573e855 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 1 Mar 2024 12:36:09 -0500 Subject: [PATCH 031/128] 24w09a -- loom build 8 --- gradle.properties | 2 +- .../java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java | 2 +- .../fi/dy/masa/tweakeroo/util/CreativeExtraItems.java | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index f1036810a..676a0f3e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w09a minecraft_version = 24w09a -mappings_version = 24w09a+build.6 +mappings_version = 24w09a+build.8 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 9af59400b..767c9b2ef 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -87,7 +87,7 @@ private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) !fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) && // Only stack up to 64, and don't steal from other stacks that are larger stackSelf.getCount() < 64 && stackSelf.getCount() >= stackOther.getCount() && - ItemStack.areItemsAndNbtEqual(stackSelf, stackOther)) + ItemStack.areItemsAndComponentsEqual(stackSelf, stackOther)) { int amount = Math.min(stackOther.getCount(), 64 - stackSelf.getCount()); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index 7fe0238fb..ddc111ea4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -7,7 +7,6 @@ import com.mojang.brigadier.StringReader; import net.minecraft.block.InfestedBlock; import net.minecraft.command.argument.ItemStringReader; -import net.minecraft.component.ComponentMap; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; @@ -95,11 +94,10 @@ public static ItemStack parseItemFromString(String str) if (item != null) { - ComponentMap components = item.getComponents(); - ItemStack stack = new ItemStack(item); + //ComponentMap components = item.getComponents(); + //stack.copyComponentsToNewStack(components); - stack.copyComponentsFrom(components); - return stack; + return new ItemStack(item); } } catch (Exception e) From 128bf7daeec43629528fbbb115c92c6117c4f12c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 2 Mar 2024 23:43:23 -0500 Subject: [PATCH 032/128] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 676a0f3e7..766c62389 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w09a minecraft_version = 24w09a -mappings_version = 24w09a+build.8 +mappings_version = 24w09a+build.9 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 From 9a1c07a2ad9f06bb6412412c44d55306a50a4df6 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 3 Mar 2024 00:50:10 -0500 Subject: [PATCH 033/128] 24w09a - fabric api 0.96.6 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 766c62389..04580f853 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,4 @@ mappings_version = 24w09a+build.9 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.4+1.20.5 +fabric_api_version = 0.96.6+1.20.5 From 3890db982992dca90abd45f1fe3b614977501652 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:35:07 -0500 Subject: [PATCH 034/128] 24w09a - add Bundle Preview --- .../java/fi/dy/masa/tweakeroo/config/Configs.java | 5 +++++ .../fi/dy/masa/tweakeroo/config/FeatureToggle.java | 1 + .../fi/dy/masa/tweakeroo/event/RenderHandler.java | 13 ++++++++++++- .../dy/masa/tweakeroo/util/CreativeExtraItems.java | 9 +++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 28096f762..bba8e5268 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -41,6 +41,8 @@ public static class Generic public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); + public static final ConfigColor BUNDLE_DISPLAY_BACKGROUND_COLOR = new ConfigColor ("bundleDisplayBgColor", "#41854F4C", "Enables tinting/coloring the Bundle display"); + public static final ConfigBoolean BUNDLE_PREVIEW_REQUIRE_SHIFT = new ConfigBoolean ("bundlePreviewRequireShift", true, "Whether holding shift is required for the Bundle Preview"); public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); @@ -154,6 +156,8 @@ public static class Generic AFTER_CLICKER_CLICK_COUNT, BLOCK_REACH_DISTANCE, BREAKING_GRID_SIZE, + BUNDLE_DISPLAY_BACKGROUND_COLOR, + BUNDLE_PREVIEW_REQUIRE_SHIFT, CUSTOM_INVENTORY_GUI_SCALE, ENTITY_REACH_DISTANCE, FAST_BLOCK_PLACEMENT_COUNT, @@ -464,6 +468,7 @@ public static void loadFromFile() // Turn off after loading the configs, just in case it was enabled in the config somehow. // But only if we are currently not in a world, since changing configs also re-loads them when closing the menu. FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); + FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 5f22d13c5..4740a2d9e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -26,6 +26,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable 'chatBackgroundColor'"), TWEAK_CHAT_PERSISTENT_TEXT ("tweakChatPersistentText", false, "", "Stores the text from the chat input text field\nand restores it when the chat is opened again"), TWEAK_CHAT_TIMESTAMP ("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index c26155614..a10e9528d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,6 +1,8 @@ package fi.dy.masa.tweakeroo.event; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.item.BundleItem; +import net.minecraft.item.Item; import org.joml.Matrix4f; import net.minecraft.client.MinecraftClient; @@ -70,7 +72,8 @@ else if (FeatureToggle.TWEAK_HOTBAR_SCROLL.getBooleanValue() && @Override public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, int y) { - if (stack.getItem() instanceof FilledMapItem) + Item item = stack.getItem(); + if (item instanceof FilledMapItem) { if (FeatureToggle.TWEAK_MAP_PREVIEW.getBooleanValue() && (!Configs.Generic.MAP_PREVIEW_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown())) @@ -78,6 +81,14 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } } + else if (item instanceof BundleItem) + { + if (FeatureToggle.TWEAK_BUNDLE_PREVIEW.getBooleanValue() && + (!Configs.Generic.BUNDLE_PREVIEW_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown())) + { + fi.dy.masa.malilib.render.RenderUtils.renderBundlePreview(stack, x, y, Configs.Generic.BUNDLE_DISPLAY_BACKGROUND_COLOR.getColor(), drawContext); + } + } else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { boolean render = !Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index ddc111ea4..c7136d575 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -4,15 +4,13 @@ import java.util.List; import javax.annotation.Nullable; import com.google.common.collect.ArrayListMultimap; -import com.mojang.brigadier.StringReader; +import fi.dy.masa.malilib.util.InventoryUtils; import net.minecraft.block.InfestedBlock; -import net.minecraft.command.argument.ItemStringReader; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemStack; -import net.minecraft.registry.BuiltinRegistries; import net.minecraft.text.TextContent; import net.minecraft.text.TranslatableTextContent; import net.minecraft.util.collection.DefaultedList; @@ -67,7 +65,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) for (String str : items) { - ItemStack stack = parseItemFromString(str); + ItemStack stack = InventoryUtils.getItemStackFromString(str); if (!stack.isEmpty()) { @@ -83,6 +81,8 @@ private static void setCreativeExtraItems(ItemGroup group, List items) } } + /* Removed in favor of new InventoryUtils.getItemStackFromString via MaLiLib + public static ItemStack parseItemFromString(String str) { try @@ -107,6 +107,7 @@ public static ItemStack parseItemFromString(String str) return ItemStack.EMPTY; } + */ public static void removeInfestedBlocks(DefaultedList stacks) { From bd9f3d7c85e3fe3836a58f47530d2b5c830b3937 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 6 Mar 2024 14:34:22 -0500 Subject: [PATCH 035/128] 24w10a - basic item attribute modifier getValue() -> value() rename --- gradle.properties | 8 ++++---- .../java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 04580f853..10b7b9d77 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w09a -minecraft_version = 24w09a -mappings_version = 24w09a+build.9 +minecraft_version_out = 24w10a +minecraft_version = 24w10a +mappings_version = 24w10a+build.1 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.6+1.20.5 +fabric_api_version = 0.96.7+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 343917041..124564cb0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -463,11 +463,11 @@ private static float getBaseAttackDamage(ItemStack stack) { if (item instanceof SwordItem) { - return (float) entry.modifier().getValue(); + return (float) entry.modifier().value(); } else if (item instanceof MiningToolItem) { - return (float) entry.modifier().getValue(); + return (float) entry.modifier().value(); } } } From b80f92e199a7ff063d158d60f5502644f7b7803e Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:50:44 -0500 Subject: [PATCH 036/128] 24w10a ghost bug hunting --- gradle.properties | 4 ++-- .../java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 10b7b9d77..1c514c6ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w10a minecraft_version = 24w10a -mappings_version = 24w10a+build.1 +mappings_version = 24w10a+build.3 fabric_loader_version = 0.15.7 mod_menu_version = 9.0.0 -fabric_api_version = 0.96.7+1.20.5 +fabric_api_version = 0.96.8+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 124564cb0..c15b0f308 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -823,15 +823,18 @@ private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumbe if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; + Tweakeroo.debugLog("swapItemToHand(): slotNumber: {}, inv.selectedSlot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else { + Tweakeroo.debugLog("swapItemToHand(): clickSlot 1, slotNumber: {}, currentHotbarSlot {}", slotNumber, currentHotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player); } } else if (hand == Hand.OFF_HAND) { + Tweakeroo.debugLog("swapItemToHand(): clickSlot 2, slotNumber: {} (button 40)", slotNumber); mc.interactionManager.clickSlot(container.syncId, slotNumber, 40, SlotActionType.SWAP, mc.player); } } @@ -850,6 +853,7 @@ public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.currentScreenHandler; + Tweakeroo.debugLog("swapSlots(): slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); @@ -867,6 +871,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; + Tweakeroo.debugLog("swapToolToHand() slotnumber: {}, inv.selected slot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else @@ -879,9 +884,11 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (hotbarSlot != selectedSlot) { inventory.selectedSlot = hotbarSlot; + Tweakeroo.debugLog("swapToolToHand() hotbarSlot: {} (vs selectedSlot {}), inv.selected slot: {} --> Yeet packet", hotbarSlot, selectedSlot, inventory.selectedSlot); Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } + Tweakeroo.debugLog("swapToolToHand(): clickSlot --> slotNumber {}, hotbarSlot {}", slotNumber, hotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); } } @@ -1043,12 +1050,14 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s if (stack.getCount() < stack.getMaxCount()) { // Pick up the item from slot1 and try to put it in slot2 + Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 1 --> slot1.id {}, slot2.id {}, (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest if (!player.getInventory().getMainHandStack().isEmpty()) { + Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 2 --> slot1.id {} (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } @@ -1125,6 +1134,7 @@ public static void switchToPickedBlock() if (isCreative) { inventory.addPickBlock(stack); + Tweakeroo.debugLog("switchToPickedBlock(): clickCreativeStack --> inv.selectedSlot {}", inventory.selectedSlot); assert mc.interactionManager != null; mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); } From b7e4f98c53643923d6130ff4c039d1b713f07948 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 8 Mar 2024 01:52:56 -0500 Subject: [PATCH 037/128] 24w10a - some cleanups and fixing TWEAK_GAMMA_OVERRIDE correctly this time. --- .../fi/dy/masa/tweakeroo/InitHandler.java | 6 ++- .../java/fi/dy/masa/tweakeroo/Reference.java | 4 ++ .../tweakeroo/event/WorldLoadListener.java | 22 ++++++++++- .../tweakeroo/tweaks/PlacementTweaks.java | 37 +++++++++---------- .../tweakeroo/util/CreativeExtraItems.java | 5 +-- .../masa/tweakeroo/util/InventoryUtils.java | 14 +++---- 6 files changed, 56 insertions(+), 32 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java index 4be534802..a59b70594 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo; +import fi.dy.masa.malilib.interfaces.IWorldLoadListener; import net.minecraft.client.MinecraftClient; import fi.dy.masa.malilib.config.ConfigManager; import fi.dy.masa.malilib.event.InputEventHandler; @@ -32,7 +33,10 @@ public void registerModHandlers() RenderEventHandler.getInstance().registerWorldLastRenderer(renderer); TickHandler.getInstance().registerClientTickHandler(new ClientTickHandler()); - WorldLoadHandler.getInstance().registerWorldLoadPreHandler(new WorldLoadListener()); + + IWorldLoadListener worldListener = new WorldLoadListener(); + WorldLoadHandler.getInstance().registerWorldLoadPreHandler(worldListener); + WorldLoadHandler.getInstance().registerWorldLoadPostHandler(worldListener); Callbacks.init(MinecraftClient.getInstance()); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/Reference.java b/src/main/java/fi/dy/masa/tweakeroo/Reference.java index a28135683..e641d5205 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Reference.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Reference.java @@ -1,10 +1,14 @@ package fi.dy.masa.tweakeroo; import fi.dy.masa.malilib.util.StringUtils; +import net.minecraft.MinecraftVersion; public class Reference { public static final String MOD_ID = "tweakeroo"; public static final String MOD_NAME = "Tweakeroo"; public static final String MOD_VERSION = StringUtils.getModVersionString(MOD_ID); + public static final String MC_VERSION = MinecraftVersion.CURRENT.getName(); + public static final String MOD_TYPE = "fabric"; + public static final String MOD_STRING = MOD_ID+"-"+MOD_TYPE+"-"+MC_VERSION+"-"+MOD_VERSION; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java index 5554a9db7..41f82a4ee 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java @@ -8,11 +8,29 @@ public class WorldLoadListener implements IWorldLoadListener { + @Override public void onWorldLoadPre(@Nullable ClientWorld worldBefore, @Nullable ClientWorld worldAfter, MinecraftClient mc) { // Always disable the Free Camera mode when leaving the world or switching dimensions FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); - FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); } -} + + @Override + public void onWorldLoadPost(@Nullable ClientWorld worldBefore, @Nullable ClientWorld worldAfter, MinecraftClient mc) + { + if (worldAfter == null) + { + // Turns off at logout + FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); + } + else if (worldBefore == null) + { + if (FeatureToggle.TWEAK_GAMMA_OVERRIDE.getBooleanValue()) + { + FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); + FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(true); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index e9c5bd843..a3684df24 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -2,7 +2,6 @@ import javax.annotation.Nullable; -import fi.dy.masa.tweakeroo.Tweakeroo; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -133,7 +132,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { if (!isEmulatedClick) { - Tweakeroo.debugLog("onProcessRightClickPre storing stack: {}", stackOriginal); + //Tweakeroo.debugLog("onProcessRightClickPre storing stack: {}", stackOriginal); cacheStackInHand(hand); } @@ -148,7 +147,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { - Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: {}, current: {}", stackBeforeUse[hand.ordinal()], player.getStackInHand(hand)); + //Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: {}, current: {}", stackBeforeUse[hand.ordinal()], player.getStackInHand(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } @@ -254,7 +253,7 @@ private static void onUsingTick() hitResult = new BlockHitResult(hitVec, side, posNew, false); ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, side {} pos {} hitResult {}, posNew {}, posLast {}", side, pos, hitResult, posNew, posLast); + //Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, side {} pos {} hitResult {}, posNew {}, posLast {}", side, pos, hitResult, posNew, posLast); if (hand != null && !posNew.equals(posLast) && canPlaceBlockIntoPosition(world, posNew, ctx) && @@ -278,7 +277,7 @@ private static void onUsingTick() ActionResult result = tryPlaceBlock(mc.interactionManager, player, mc.world, posNew, sideFirst, sideRotatedFirst, playerYawFirst, hitVec, hand, hitPartFirst, false); - Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, tryPlaceBlock: hitVec {} result {}", hitVec, result); + //Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, tryPlaceBlock: hitVec {} result {}", hitVec, result); if (result == ActionResult.SUCCESS) { @@ -305,7 +304,7 @@ else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && { final int count = Configs.Generic.FAST_RIGHT_CLICK_COUNT.getIntegerValue(); - Tweakeroo.debugLog("onUsingTick(): fastRightClick, count {} ", count); + //Tweakeroo.debugLog("onUsingTick(): fastRightClick, count {} ", count); for (int i = 0; i < count; ++i) { @@ -370,7 +369,7 @@ public static ActionResult onProcessRightClickBlock( return ActionResult.PASS; } - Tweakeroo.debugLog("onProcessRightClickBlock() pos: {}, side: {}, part: {}, hitVec: {}", posIn, sideIn, hitPart, hitVec); + //Tweakeroo.debugLog("onProcessRightClickBlock() pos: {}, side: {}, part: {}, hitVec: {}", posIn, sideIn, hitPart, hitVec); ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); // Store the initial click data for the fast placement mode @@ -396,7 +395,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - Tweakeroo.debugLog("plop store @ {}", posFirst); + //Tweakeroo.debugLog("plop store @ {}", posFirst); } return result; @@ -510,7 +509,7 @@ private static ActionResult tryPlaceBlock( { facing = facing.getOpposite(); } - Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: {}", facing); + //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: {}", facing); } else if (!flexible || !rotation) { @@ -535,7 +534,7 @@ else if (!flexible || !rotation) } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: {}, state: {}, hit: {}, posIn: {}, posNew: {}", sideIn, state, hitVec, posIn, posNew); + //Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: {}, state: {}, hit: {}, posIn: {}, posNew: {}", sideIn, state, hitVec, posIn, posNew); if (facingTmp != null) { @@ -550,7 +549,7 @@ else if (!flexible || !rotation) if (accurateReverse) { - Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: {}, facingNew: {}", facing, facing.getOpposite()); + //Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: {}, facingNew: {}", facing, facing.getOpposite()); if (accurateIn || !flexible || !rotation) { facing = facing.getOpposite(); @@ -577,13 +576,13 @@ else if (!flexible || !rotation) x += afterClickerClickCount * 16; } - Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: {}", hitVec); - Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: {}, x: {}, posNew: {}, side: {}", facing, x, posNew, side); + //Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: {}", hitVec); + //Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: {}, x: {}, posNew: {}, side: {}", facing, x, posNew, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: {}", hitVec); + //Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: {}", hitVec); } - Tweakeroo.debugLog("PlacementTweaks#accurate - facing: {}, side: {}, posNew: {}, hit: {}", facing, side, posNew, hitVec); + //Tweakeroo.debugLog("PlacementTweaks#accurate - facing: {}, side: {}, posNew: {}, hit: {}", facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } @@ -595,7 +594,7 @@ else if (!flexible || !rotation) if (canPlaceBlockIntoPosition(world, posNew, ctx)) { // Re-enable Debug logging for now - Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: {}, side: {}, part: {}, hitVec: {}", posNew, side, hitPart, hitVec); + //Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: {}, side: {}, part: {}, hitVec: {}", posNew, side, hitPart, hitVec); return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); } else @@ -789,7 +788,7 @@ private static ActionResult processRightClickBlockWrapper( x += afterClickerClickCount * 16; } - Tweakeroo.debugLog("processRightClickBlockWrapper req facing: {}, x: {}, pos: {}, sideIn: {}", facing, x, posIn, sideIn); + //Tweakeroo.debugLog("processRightClickBlockWrapper req facing: {}, x: {}, pos: {}, sideIn: {}", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } @@ -833,7 +832,7 @@ private static ActionResult processRightClickBlockWrapper( // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: {}, current: {}", stackOriginal, player.getStackInHand(hand)); + //Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: {}, current: {}", stackOriginal, player.getStackInHand(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && @@ -905,7 +904,7 @@ else if (hitPart == HitPart.RIGHT) player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: {}, side: {}, facing orig: yaw: {} / pitch: {} facing new: {}", pos, side, yaw, pitch, facing); + //Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: {}, side: {}, facing orig: yaw: {} / pitch: {} facing new: {}", pos, side, yaw, pitch, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index c7136d575..fc49ef7a4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -14,7 +14,6 @@ import net.minecraft.text.TextContent; import net.minecraft.text.TranslatableTextContent; import net.minecraft.util.collection.DefaultedList; -import fi.dy.masa.tweakeroo.Tweakeroo; public class CreativeExtraItems { @@ -61,7 +60,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) return; } - Tweakeroo.logger.info("Adding extra items to creative inventory group '{}'", group.getDisplayName().getString()); + //Tweakeroo.logger.info("Adding extra items to creative inventory group '{}'", group.getDisplayName().getString()); for (String str : items) { @@ -81,7 +80,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) } } - /* Removed in favor of new InventoryUtils.getItemStackFromString via MaLiLib + /* Removed in favor of a new InventoryUtils.getItemStackFromString via MaLiLib public static ItemStack parseItemFromString(String str) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index c15b0f308..d18ae2297 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -823,18 +823,18 @@ private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumbe if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; - Tweakeroo.debugLog("swapItemToHand(): slotNumber: {}, inv.selectedSlot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); + //Tweakeroo.debugLog("swapItemToHand(): slotNumber: {}, inv.selectedSlot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else { - Tweakeroo.debugLog("swapItemToHand(): clickSlot 1, slotNumber: {}, currentHotbarSlot {}", slotNumber, currentHotbarSlot); + //Tweakeroo.debugLog("swapItemToHand(): clickSlot 1, slotNumber: {}, currentHotbarSlot {}", slotNumber, currentHotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player); } } else if (hand == Hand.OFF_HAND) { - Tweakeroo.debugLog("swapItemToHand(): clickSlot 2, slotNumber: {} (button 40)", slotNumber); + //Tweakeroo.debugLog("swapItemToHand(): clickSlot 2, slotNumber: {} (button 40)", slotNumber); mc.interactionManager.clickSlot(container.syncId, slotNumber, 40, SlotActionType.SWAP, mc.player); } } @@ -853,7 +853,7 @@ public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.currentScreenHandler; - Tweakeroo.debugLog("swapSlots(): slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); + //Tweakeroo.debugLog("swapSlots(): slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); @@ -871,7 +871,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; - Tweakeroo.debugLog("swapToolToHand() slotnumber: {}, inv.selected slot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); + //Tweakeroo.debugLog("swapToolToHand() slotnumber: {}, inv.selected slot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else @@ -884,11 +884,11 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (hotbarSlot != selectedSlot) { inventory.selectedSlot = hotbarSlot; - Tweakeroo.debugLog("swapToolToHand() hotbarSlot: {} (vs selectedSlot {}), inv.selected slot: {} --> Yeet packet", hotbarSlot, selectedSlot, inventory.selectedSlot); + //Tweakeroo.debugLog("swapToolToHand() hotbarSlot: {} (vs selectedSlot {}), inv.selected slot: {} --> Yeet packet", hotbarSlot, selectedSlot, inventory.selectedSlot); Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } - Tweakeroo.debugLog("swapToolToHand(): clickSlot --> slotNumber {}, hotbarSlot {}", slotNumber, hotbarSlot); + //Tweakeroo.debugLog("swapToolToHand(): clickSlot --> slotNumber {}, hotbarSlot {}", slotNumber, hotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); } } From 6a2e95ba3ca5e5619c4a00d9d6b081a8dd520f69 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 10 Mar 2024 23:29:40 -0400 Subject: [PATCH 038/128] 24w10a - ModMenu 10.0.0-alpha.3 update --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1c514c6ba..704eab3b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,5 @@ minecraft_version = 24w10a mappings_version = 24w10a+build.3 fabric_loader_version = 0.15.7 -mod_menu_version = 9.0.0 +mod_menu_version = 10.0.0-alpha.3 fabric_api_version = 0.96.8+1.20.5 From 9b804becc1da28a8fcb3821ec3faf6a593ec58c3 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:06:03 -0400 Subject: [PATCH 039/128] 24w10a - fabric 0.96.9 yarn build 8 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 704eab3b5..6e9cb8cd5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w10a minecraft_version = 24w10a -mappings_version = 24w10a+build.3 +mappings_version = 24w10a+build.8 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 -fabric_api_version = 0.96.8+1.20.5 +fabric_api_version = 0.96.9+1.20.5 From 54ba245f9941d4a2408981108ee47edb2f4e3bec Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 14 Mar 2024 13:22:50 -0400 Subject: [PATCH 040/128] 24w11a - yarn build 2 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6e9cb8cd5..9d1f66aef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,9 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w10a -minecraft_version = 24w10a -mappings_version = 24w10a+build.8 +minecraft_version_out = 24w11a +minecraft_version = 24w11a +mappings_version = 24w11a+build.2 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 From a73be235627ea49d1a96673b04a1664cc5d3e133 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 14 Mar 2024 21:56:35 -0400 Subject: [PATCH 041/128] 24w11a - fabric 0.96.10 and shulker box preview fix --- gradle.properties | 2 +- .../fi/dy/masa/tweakeroo/event/RenderHandler.java | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9d1f66aef..45067a670 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,4 @@ mappings_version = 24w11a+build.2 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 -fabric_api_version = 0.96.9+1.20.5 +fabric_api_version = 0.96.10+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index a10e9528d..b2285958c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,6 +1,7 @@ package fi.dy.masa.tweakeroo.event; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.component.DataComponentTypes; import net.minecraft.item.BundleItem; import net.minecraft.item.Item; import org.joml.Matrix4f; @@ -89,13 +90,16 @@ else if (item instanceof BundleItem) fi.dy.masa.malilib.render.RenderUtils.renderBundlePreview(stack, x, y, Configs.Generic.BUNDLE_DISPLAY_BACKGROUND_COLOR.getColor(), drawContext); } } - else if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) + else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && item.toString().contains("shulker")) { - boolean render = !Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown(); - - if (render) + if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { - fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); + boolean render = !Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown(); + + if (render) + { + fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); + } } } } From 431c1b25bc94ee0455d7cee56ec07025a30d9d27 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:42:50 -0400 Subject: [PATCH 042/128] 24w11a - chasing ghost bugs for ClickSlot packets -- Not finding any issues. --- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d18ae2297..d12f6e78c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -305,6 +305,7 @@ public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) { + //Tweakeroo.debugLog("swapHotbarWithInventoryRow(): slot {}, hotbarSlot {} --> malilib.InventoryUtils.swapSlots()", slot, hotbarSlot); fi.dy.masa.malilib.util.InventoryUtils.swapSlots(container, slot, hotbarSlot); slot++; } @@ -326,6 +327,7 @@ public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemSta if (slotWithItem != -1) { + //Tweakeroo.debugLog("restockNewStackToHand(): hand {}, slotWithItem {}", hand.name(), slotWithItem); swapItemToHand(player, hand, slotWithItem); } } @@ -365,6 +367,7 @@ public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowH // stack in hand, then left click, otherwise right click to split the stack int button = stackSlot.getCount() + stackHand.getCount() <= stackHand.getMaxCount() ? 0 : 1; + //Tweakeroo.debugLog("preRestockHand(): syncId {}, slot id {}, button {} // pickup --> currentSlot {}", container.syncId, slot.id, button, currentSlot); mc.interactionManager.clickSlot(container.syncId, slot.id, button, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, currentSlot, 0, SlotActionType.PICKUP, player); @@ -716,6 +719,7 @@ private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type if (slotRepairableItem != -1) { + //Tweakeroo.debugLog("repairModeHandleSlot(): type {} // slotRepairableItem {}", type.asString(), slotRepairableItem); swapItemToEquipmentSlot(player, type, slotRepairableItem); InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", type.getName()); } @@ -764,6 +768,7 @@ public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) if (targetSlot >= 0) { //targetSlots.sort(); + //Tweakeroo.debugLog("swapElytraWithChestPlate(): chest, target slot {}", targetSlot); swapItemToEquipmentSlot(player, EquipmentSlot.CHEST, targetSlot); } } @@ -853,9 +858,11 @@ public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) { MinecraftClient mc = MinecraftClient.getInstance(); ScreenHandler container = player.currentScreenHandler; - //Tweakeroo.debugLog("swapSlots(): slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); + //Tweakeroo.debugLog("swapSlots(): click slot 1, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + //Tweakeroo.debugLog("swapSlots(): click slot 2, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); + //Tweakeroo.debugLog("swapSlots(): click slot 3, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); } @@ -1050,14 +1057,14 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s if (stack.getCount() < stack.getMaxCount()) { // Pick up the item from slot1 and try to put it in slot2 - Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 1 --> slot1.id {}, slot2.id {}, (button 0)",slot1.id, slot2.id); + //Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 1 --> slot1.id {}, slot2.id {}, (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest if (!player.getInventory().getMainHandStack().isEmpty()) { - Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 2 --> slot1.id {} (button 0)",slot1.id, slot2.id); + //Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 2 --> slot1.id {} (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } @@ -1134,7 +1141,7 @@ public static void switchToPickedBlock() if (isCreative) { inventory.addPickBlock(stack); - Tweakeroo.debugLog("switchToPickedBlock(): clickCreativeStack --> inv.selectedSlot {}", inventory.selectedSlot); + //Tweakeroo.debugLog("switchToPickedBlock(): clickCreativeStack --> inv.selectedSlot {}", inventory.selectedSlot); assert mc.interactionManager != null; mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); } From 0283b3eb8c27f53848eff80480b743f60382fff4 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:33:57 -0400 Subject: [PATCH 043/128] 24w12a - fix itemStack.getItem().isDamagable() --> not yet working --- gradle.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 45067a670..a95ba4e4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w11a -minecraft_version = 24w11a -mappings_version = 24w11a+build.2 +minecraft_version_out = 24w12a +minecraft_version = 24w12a +mappings_version = 24w12a+build.2 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 -fabric_api_version = 0.96.10+1.20.5 +fabric_api_version = 0.96.11+1.20.5 From 2bbc1939d3b388d74201842fad296814537f05de Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:39:13 -0400 Subject: [PATCH 044/128] 24w12a - fix itemStack.getItem().isDamagable() -> itemStack.isDamageable() --- src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d12f6e78c..8cfa75ed3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -315,7 +315,7 @@ public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemSta { int slotWithItem; - if (stackReference.getItem().isDamageable()) + if (stackReference.isDamageable()) { int minDurability = getMinDurability(stackReference); slotWithItem = findSlotWithSuitableReplacementToolWithDurabilityLeft(player.playerScreenHandler, stackReference, minDurability); From d85ca7c9bbbf7072bd1214a8d66afc58a3d56fff Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:06:54 -0400 Subject: [PATCH 045/128] 24w12a - loom 1.6, yarn build 3, api 0.96.12 --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b2194487e..82830c30a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index a95ba4e4f..01d8d0c17 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w12a minecraft_version = 24w12a -mappings_version = 24w12a+build.2 +mappings_version = 24w12a+build.3 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 -fabric_api_version = 0.96.11+1.20.5 +fabric_api_version = 0.96.12+1.20.5 From 9ae4e4ac26d74668a41db1966a21b4aff9be0ef1 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 27 Mar 2024 14:09:24 -0400 Subject: [PATCH 046/128] 24w13a - chat Hud fix --- gradle.properties | 6 +++--- src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 01d8d0c17..c8ad3878b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,9 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w12a -minecraft_version = 24w12a -mappings_version = 24w12a+build.3 +minecraft_version_out = 24w13a +minecraft_version = 24w13a +mappings_version = 24w13a+build.2 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java index f853c9777..49eb76c12 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java @@ -18,16 +18,17 @@ @Mixin(value = ChatHud.class, priority = 1100) public abstract class MixinChatHud { - @ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", + @ModifyVariable(method = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), argsOnly = true) - private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, int ticks, MessageIndicator indicator, boolean refreshing) + private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) { // If we're refreshing, we have probably already modified the message, therefore we don't want to do anything. +/* if (refreshing) { return componentIn; } - + */ if (FeatureToggle.TWEAK_CHAT_TIMESTAMP.getBooleanValue()) { MutableText newComponent = Text.literal(MiscUtils.getChatTimestamp() + " "); From 2f70d15a1f8392c26cbd07fc7d0dd39a0df21600 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:23:35 -0400 Subject: [PATCH 047/128] 24w13a - yarn build 7, api 0.96.13 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index c8ad3878b..462e4a50b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w13a minecraft_version = 24w13a -mappings_version = 24w13a+build.2 +mappings_version = 24w13a+build.7 fabric_loader_version = 0.15.7 mod_menu_version = 10.0.0-alpha.3 -fabric_api_version = 0.96.12+1.20.5 +fabric_api_version = 0.96.13+1.20.5 From 19ddb9d3981019a54b630a47c404337bd1e282b0 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:51:18 -0400 Subject: [PATCH 048/128] 24w13a - add ModMenu parent for malilib --- src/main/resources/fabric.mod.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0d0a924cf..badd58fb0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -35,5 +35,10 @@ "depends": { "minecraft": ">=1.20.4", "malilib": ">=0.19.0-snap" + }, + "custom": { + "modmenu": { + "parent": "malilib" + } } } From 861c1f549366c0a4caac5fc2f8203a9d701aef25 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 29 Mar 2024 19:29:07 -0400 Subject: [PATCH 049/128] 24w13a - update ModMenu Dependency to a custom SNAPSHOT build, because 10.0.0-alpha.3 does not support 24w13a correctly. --- build.gradle | 5 ++++- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 82830c30a..68de209e9 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,10 @@ repositories { url 'https://masa.dy.fi/maven' mavenLocal() } - maven { url 'https://maven.terraformersmc.com/releases/' } + maven { + url 'https://maven.terraformersmc.com/releases/' + mavenLocal() + } // maven { url 'https://maven.quiltmc.org/repository/release/' } flatDir { dirs 'libs' } } diff --git a/gradle.properties b/gradle.properties index 462e4a50b..2ff5af0b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,5 @@ minecraft_version = 24w13a mappings_version = 24w13a+build.7 fabric_loader_version = 0.15.7 -mod_menu_version = 10.0.0-alpha.3 +mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 fabric_api_version = 0.96.13+1.20.5 From ffaaa675e1ffb8610379f37d0714e474419281e2 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:48:38 -0400 Subject: [PATCH 050/128] 24w14a - java 21, shulker box tooltip slight Mixin change --- build.gradle | 8 ++++---- gradle.properties | 10 +++++----- .../dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java | 7 +++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 68de209e9..6456cfc5b 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ plugins { id 'fabric-loom' version '1.6-SNAPSHOT' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 repositories { // maven { url 'https://masa.dy.fi/maven' } @@ -65,8 +65,8 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. - it.options.release = 17 + // Minecraft 1.20.5/1.21 (24w14a) upwards uses Java 21. + it.options.release = 21 } tasks.withType(AbstractArchiveTask).configureEach { diff --git a/gradle.properties b/gradle.properties index 2ff5af0b9..3489ec821 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.20.0-snap malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w13a -minecraft_version = 24w13a -mappings_version = 24w13a+build.7 +minecraft_version_out = 24w14a +minecraft_version = 24w14a +mappings_version = 24w14a+build.3 -fabric_loader_version = 0.15.7 +fabric_loader_version = 0.15.9 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 -fabric_api_version = 0.96.13+1.20.5 +fabric_api_version = 0.96.14+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index 360d27e92..efba720d3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -2,23 +2,22 @@ import java.util.List; -import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.client.item.TooltipType; +import net.minecraft.item.Item; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.block.ShulkerBoxBlock; -import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.world.BlockView; import fi.dy.masa.tweakeroo.config.Configs; @Mixin(ShulkerBoxBlock.class) public abstract class MixinShulkerBoxBlock { @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void removeVanillaTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options, DynamicRegistryManager registryManager, CallbackInfo ci) + private void removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) { if (Configs.Disable.DISABLE_SHULKER_BOX_TOOLTIP.getBooleanValue()) { From f43fc43e20d6e6be171108ace9cf42e31c452cc7 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 4 Apr 2024 16:24:39 -0400 Subject: [PATCH 051/128] 24w14a - some code cleanups --- gradle/wrapper/gradle-wrapper.properties | 2 - .../dy/masa/tweakeroo/config/Callbacks.java | 11 ++-- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 + .../masa/tweakeroo/event/RenderHandler.java | 3 -- .../tweakeroo/event/WorldLoadListener.java | 1 - .../tweakeroo/mixin/IMixinAbstractBlock.java | 2 +- .../mixin/IMixinAbstractHorseEntity.java | 2 +- .../masa/tweakeroo/mixin/IMixinAxeItem.java | 2 +- .../mixin/IMixinChunkLightProvider.java | 2 +- .../tweakeroo/mixin/IMixinClientWorld.java | 2 +- .../mixin/IMixinCommandBlockExecutor.java | 4 +- .../tweakeroo/mixin/IMixinShovelItem.java | 2 +- .../tweakeroo/mixin/IMixinSimpleOption.java | 2 +- .../MixinAbstractClientPlayerEntity.java | 2 +- .../mixin/MixinAbstractInventoryScreen.java | 2 +- .../mixin/MixinAbstractSignEditScreen.java | 4 +- .../mixin/MixinBackgroundRenderer.java | 10 ++-- .../masa/tweakeroo/mixin/MixinBatEntity.java | 2 +- .../mixin/MixinBeaconBlockEntityRenderer.java | 2 +- .../MixinBlockEntityRenderDispatcher.java | 4 +- .../masa/tweakeroo/mixin/MixinBlockItem.java | 15 ++++-- .../masa/tweakeroo/mixin/MixinBossBarHud.java | 2 +- .../masa/tweakeroo/mixin/MixinBuiltChunk.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinChatHud.java | 11 +--- .../masa/tweakeroo/mixin/MixinChatScreen.java | 8 +-- .../mixin/MixinChunkBuilder_BuiltChunk.java | 2 +- .../mixin/MixinClientCommandSource.java | 12 ++--- .../mixin/MixinClientPlayNetworkHandler.java | 4 +- .../mixin/MixinClientPlayerEntity.java | 20 ++++---- .../MixinClientPlayerInteractionManager.java | 18 +++---- .../tweakeroo/mixin/MixinClientWorld.java | 8 +-- .../mixin/MixinClientWorld_Properties.java | 2 +- .../tweakeroo/mixin/MixinCloneCommand.java | 2 +- .../mixin/MixinCommandBlockScreen.java | 8 +-- .../mixin/MixinCreativeInventoryScreen.java | 2 +- .../mixin/MixinDimensionEffects_Nether.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinEntity.java | 20 +++++--- .../mixin/MixinEntityRenderDispatcher.java | 2 +- .../masa/tweakeroo/mixin/MixinExplosion.java | 14 +---- .../tweakeroo/mixin/MixinFillCommand.java | 2 +- .../tweakeroo/mixin/MixinGameRenderer.java | 24 ++++----- .../mixin/MixinHeldItemRenderer.java | 2 +- .../masa/tweakeroo/mixin/MixinInGameHud.java | 10 ++-- .../fi/dy/masa/tweakeroo/mixin/MixinItem.java | 2 +- .../masa/tweakeroo/mixin/MixinItemEntity.java | 19 ++++--- .../masa/tweakeroo/mixin/MixinItemGroup.java | 2 +- .../masa/tweakeroo/mixin/MixinItemStack.java | 2 +- .../tweakeroo/mixin/MixinKeyboardInput.java | 2 +- .../mixin/MixinLightingProvider.java | 4 +- .../tweakeroo/mixin/MixinLivingEntity.java | 40 ++++++++++----- .../tweakeroo/mixin/MixinMinecraftClient.java | 10 ++-- .../MixinMobSpawnerBlockEntityRenderer.java | 2 +- .../tweakeroo/mixin/MixinMobSpawnerLogic.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinMouse.java | 2 +- .../mixin/MixinNetherPortalBlock.java | 4 +- .../tweakeroo/mixin/MixinObserverBlock.java | 2 +- .../tweakeroo/mixin/MixinParticleManager.java | 4 +- .../tweakeroo/mixin/MixinPlayerAbilities.java | 2 +- .../tweakeroo/mixin/MixinPlayerEntity.java | 48 +++++++++++++---- .../tweakeroo/mixin/MixinPresetsScreen.java | 7 +-- .../tweakeroo/mixin/MixinRavagerEntity.java | 4 +- .../tweakeroo/mixin/MixinSculkSensor.java | 2 +- .../mixin/MixinServerPlayNetworkHandler.java | 2 +- .../tweakeroo/mixin/MixinShulkerBoxBlock.java | 3 +- .../tweakeroo/mixin/MixinSignBlockEntity.java | 13 +++-- .../masa/tweakeroo/mixin/MixinSlimeBlock.java | 2 +- .../mixin/MixinStructureBlockBlockEntity.java | 9 +++- .../mixin/MixinTeleportSpectatorMenu.java | 2 +- .../mixin/MixinThreadedAnvilChunkStorage.java | 2 +- .../masa/tweakeroo/mixin/MixinTradeOffer.java | 2 +- .../MixinUpdateStructureBlockC2SPacket.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinWindow.java | 6 +-- .../dy/masa/tweakeroo/mixin/MixinWorld.java | 6 +-- .../tweakeroo/mixin/MixinWorldRenderer.java | 15 +++--- .../masa/tweakeroo/renderer/RenderUtils.java | 12 ++--- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 4 +- .../tweakeroo/tweaks/PlacementHandler.java | 4 +- .../tweakeroo/tweaks/PlacementTweaks.java | 51 +++++++++---------- .../dy/masa/tweakeroo/util/CameraEntity.java | 4 +- .../tweakeroo/util/CreativeExtraItems.java | 32 +----------- .../masa/tweakeroo/util/InventoryUtils.java | 37 +++----------- .../fi/dy/masa/tweakeroo/util/MiscUtils.java | 10 ++-- 82 files changed, 313 insertions(+), 320 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22ce5..17655d0ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 -validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java index fc49169ed..381816477 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.config; +import fi.dy.masa.tweakeroo.Tweakeroo; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.SignBlockEntity; @@ -181,9 +182,11 @@ public void onValueChanged(IConfigBoolean config) private void applyValue(double gamma) { + Tweakeroo.debugLog("Callbacks#applyValue(): pre"); @SuppressWarnings("unchecked") IMixinSimpleOption opt = (IMixinSimpleOption) (Object) this.mc.options.getGamma(); - opt.tweakeroo_setValueWithoutCheck(gamma); + Tweakeroo.debugLog("Callbacks#applyValue(): post"); + opt.tweakeroo$setValueWithoutCheck(gamma); } } @@ -196,7 +199,7 @@ public FeatureCallbackSlime(ConfigBoolean feature) // If the feature is enabled on game launch, apply the overridden value here if (feature.getBooleanValue()) { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction(Blocks.STONE.getSlipperiness()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction(Blocks.STONE.getSlipperiness()); } } @@ -205,11 +208,11 @@ public void onValueChanged(ConfigBoolean config) { if (config.getBooleanValue()) { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction(Blocks.STONE.getSlipperiness()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction(Blocks.STONE.getSlipperiness()); } else { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction((float) Configs.Internal.SLIME_BLOCK_SLIPPERINESS_ORIGINAL.getDoubleValue()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction((float) Configs.Internal.SLIME_BLOCK_SLIPPERINESS_ORIGINAL.getDoubleValue()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index bba8e5268..fe109d055 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -98,6 +98,7 @@ public static class Generic public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true, "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true, "Whether or not holding shift is required for the Shulker Box preview"); + public static final ConfigInteger SHULKER_MAX_STACK_SIZE = new ConfigInteger ("shulkerMaxStackSize", 64, 1, 99, "Maximum Stack Size for Stacking Shulker Boxes.\nNote that Carpet Mod values use 1, 16, and 64 as common settings."); public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true, "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false, "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true, "Whether or not to render the snap aim angle indicator"); @@ -133,6 +134,7 @@ public static class Generic REMEMBER_FLEXIBLE, SHULKER_DISPLAY_BACKGROUND_COLOR, SHULKER_DISPLAY_REQUIRE_SHIFT, + SHULKER_MAX_STACK_SIZE, SLOT_SYNC_WORKAROUND, SLOT_SYNC_WORKAROUND_ALWAYS, SNAP_AIM_INDICATOR, diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index b2285958c..83bf29f39 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -111,9 +111,6 @@ public void onRenderWorldLast(Matrix4f matrix4f, Matrix4f projMatrix) if (mc.player != null) { - //MatrixStack matrixStack = new MatrixStack(); - //matrixStack.multiplyPositionMatrix(matrix4f); - this.renderOverlays(matrix4f, mc); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java index 41f82a4ee..c0dde54f6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java @@ -8,7 +8,6 @@ public class WorldLoadListener implements IWorldLoadListener { - @Override public void onWorldLoadPre(@Nullable ClientWorld worldBefore, @Nullable ClientWorld worldAfter, MinecraftClient mc) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java index a68042d4c..be401621a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java @@ -9,5 +9,5 @@ public interface IMixinAbstractBlock { @Mutable @Accessor("slipperiness") - void setFriction(float friction); + void tweakeroo$setFriction(float friction); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java index e02f31c97..f7e2de3ae 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java @@ -9,5 +9,5 @@ public interface IMixinAbstractHorseEntity { @Accessor("items") - SimpleInventory tweakeroo_getHorseInventory(); + SimpleInventory tweakeroo$getHorseInventory(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java index 330d4ce24..d0848dece 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java @@ -10,5 +10,5 @@ public interface IMixinAxeItem { @Accessor("STRIPPED_BLOCKS") - static Map tweakeroo_getStrippedBlocks() { return null; } + static Map tweakeroo$getStrippedBlocks() { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java index 926ea4b36..fc9225308 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java @@ -9,5 +9,5 @@ public interface IMixinChunkLightProvider { @Accessor("chunkProvider") - ChunkProvider tweakeroo_getChunkProvider(); + ChunkProvider tweakeroo$getChunkProvider(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java index 859cb42f4..bdf476f89 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java @@ -10,5 +10,5 @@ public interface IMixinClientWorld { @Invoker("getMapStates") - Map tweakeroo_getMapStates(); + Map tweakeroo$getMapStates(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java index 52c96593d..afa15a126 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java @@ -8,8 +8,8 @@ public interface IMixinCommandBlockExecutor { @Accessor("updateLastExecution") - boolean getUpdateLastExecution(); + boolean tweakeroo$getUpdateLastExecution(); @Accessor("updateLastExecution") - void setUpdateLastExecution(boolean value); + void tweakeroo$setUpdateLastExecution(boolean value); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java index f07b543ef..2c4dc795d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java @@ -11,5 +11,5 @@ public interface IMixinShovelItem { @Accessor("PATH_STATES") - static Map tweakeroo_getPathStates() { return null; } + static Map tweakeroo$getPathStates() { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java index 2c3042ec9..24f95927c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java @@ -8,5 +8,5 @@ public interface IMixinSimpleOption { @Accessor("value") - void tweakeroo_setValueWithoutCheck(T value); + void tweakeroo$setValueWithoutCheck(T value); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java index db8dc74fc..2cb77cf11 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java @@ -12,7 +12,7 @@ public abstract class MixinAbstractClientPlayerEntity { @Inject(method = "isSpectator", at = @At("HEAD"), cancellable = true) - private void overrideIsSpectator(CallbackInfoReturnable cir) + private void tweakeroo$overrideIsSpectator(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && CameraUtils.getFreeCameraSpectator()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java index ed66085e9..5d3a250fc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java @@ -23,7 +23,7 @@ private MixinAbstractInventoryScreen(T container, PlayerInventory playerInventor } @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) - private void disableStatusEffectRendering(DrawContext drawContext, int mouseX, int mouseY, CallbackInfo ci) + private void tweakeroo$disableStatusEffectRendering(DrawContext drawContext, int mouseX, int mouseY, CallbackInfo ci) { if (Configs.Disable.DISABLE_INVENTORY_EFFECTS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java index 2b72028a5..005c19fac 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java @@ -45,7 +45,7 @@ protected MixinAbstractSignEditScreen(Text textComponent) } @Inject(method = "removed", at = @At("HEAD")) - private void storeText(CallbackInfo ci) + private void tweakeroo$storeText(CallbackInfo ci) { if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue()) { @@ -54,7 +54,7 @@ private void storeText(CallbackInfo ci) } @Inject(method = "init", at = @At("RETURN")) - private void preventGuiOpen(CallbackInfo ci) + private void tweakeroo$preventGuiOpen(CallbackInfo ci) { if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index de15adfe4..58f0cb66d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -31,7 +31,7 @@ public abstract class MixinBackgroundRenderer to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), constant = @Constant(floatValue = 0.25f), require = 0) - private static float reduceLavaFogStart(float original) + private static float tweakeroo$reduceLavaFogStart(float original) { wasLava = true; @@ -48,9 +48,9 @@ private static float reduceLavaFogStart(float original) slice = @Slice( from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/registry/entry/RegistryEntry;"), to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), - constant = { @Constant(floatValue = 1.0f), @Constant(floatValue = 3.0f)}, + constant = { @Constant(floatValue = 1.0f), @Constant(floatValue = 5.0f)}, require = 0) - private static float reduceLavaFogEnd(float original) + private static float tweakeroo$reduceLavaFogEnd(float original) { wasLava = true; @@ -97,7 +97,7 @@ private static float overrideFogEnd(float original) @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld$Properties;getHorizonShadingRatio()F")) - private static float tweakeroo_disableSkyDarkness(ClientWorld.Properties props) + private static float tweakeroo$disableSkyDarkness(ClientWorld.Properties props) { return Configs.Disable.DISABLE_SKY_DARKNESS.getBooleanValue() ? 1.0F : props.getHorizonShadingRatio(); } @@ -107,7 +107,7 @@ private static float tweakeroo_disableSkyDarkness(ClientWorld.Properties props) at = @At(value = "INVOKE", remap = false, target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderFogEnd(F)V", shift = At.Shift.AFTER)) - private static void disableRenderDistanceFog( + private static void tweakeroo$disableRenderDistanceFog( Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java index ee0a27dcd..b7be69f1d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java @@ -16,7 +16,7 @@ public abstract class MixinBatEntity { @Inject(method = "canSpawn", at = @At("HEAD"), cancellable = true) - private static void tweakeroo_disableBatSpawning(EntityType type, + private static void tweakeroo$disableBatSpawning(EntityType type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java index 4273bb3a4..5da718c85 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java @@ -15,7 +15,7 @@ public abstract class MixinBeaconBlockEntityRenderer { @Inject(method = "render(Lnet/minecraft/block/entity/BeaconBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo_disableBeamRendering(BeaconBlockEntity beaconBlockEntity, + private void tweakeroo$disableBeamRendering(BeaconBlockEntity beaconBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java index 41bc67674..35381247f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java @@ -14,7 +14,7 @@ public abstract class MixinBlockEntityRenderDispatcher "Lnet/minecraft/block/entity/BlockEntity;F" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;)V", at = @At("HEAD"), cancellable = true) - private void preventTileEntityRendering( + private void tweakeroo$preventTileEntityRendering( net.minecraft.block.entity.BlockEntity tileentityIn, float partialTicks, net.minecraft.client.util.math.MatrixStack matrixStack, @@ -30,7 +30,7 @@ private void preventTileEntityRendering( "Lnet/minecraft/block/entity/BlockEntity;" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;II)Z", at = @At("HEAD"), cancellable = true) - private void preventTileEntityRendering( + private void tweakeroo$preventTileEntityRendering( net.minecraft.block.entity.BlockEntity tileEntityIn, net.minecraft.client.util.math.MatrixStack matrixStack, net.minecraft.client.render.VertexConsumerProvider vertexConsumerProvider, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index 8cc015611..2211d473e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -32,7 +32,7 @@ private MixinBlockItem(Item.Settings builder) @Shadow public abstract Block getBlock(); @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void modifyPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) + private void tweakeroo$modifyPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { if (Configs.Generic.CLIENT_PLACEMENT_ROTATION.getBooleanValue()) { @@ -70,11 +70,16 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx @Override public int tweakeroo$getMaxStackSize(ItemStack stack) { - if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && - ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && - !InventoryUtils.shulkerBoxHasItems(stack)) + if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue()) { - return 64; + Block block = this.getBlock(); + if (block instanceof ShulkerBoxBlock) + { + if (InventoryUtils.shulkerBoxHasItems(stack) == false) + { + return Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue(); + } + } } // FIXME How to call the stack-sensitive version on the super class? diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java index 55656cfb9..db8890da2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java @@ -14,7 +14,7 @@ public abstract class MixinBossBarHud { @Inject(method = "render", at = @At("HEAD"), cancellable = true) - private void tweakeroo_disableBossBarRendering(DrawContext drawContext, CallbackInfo ci) + private void tweakeroo$disableBossBarRendering(DrawContext drawContext, CallbackInfo ci) { if (Configs.Disable.DISABLE_BOSS_BAR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java index 24461c939..30391b2d6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java @@ -11,7 +11,7 @@ public abstract class MixinBuiltChunk { @Inject(method = "scheduleRebuild(Z)V", at = @At("HEAD"), cancellable = true) - private void disableChunkReRenders(boolean important, CallbackInfo ci) + private void tweakeroo$disableChunkReRenders(boolean important, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java index 49eb76c12..b9d3619c0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java @@ -20,15 +20,8 @@ public abstract class MixinChatHud { @ModifyVariable(method = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), argsOnly = true) - private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) + private Text tweakeroo$addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) { - // If we're refreshing, we have probably already modified the message, therefore we don't want to do anything. -/* - if (refreshing) - { - return componentIn; - } - */ if (FeatureToggle.TWEAK_CHAT_TIMESTAMP.getBooleanValue()) { MutableText newComponent = Text.literal(MiscUtils.getChatTimestamp() + " "); @@ -41,7 +34,7 @@ private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessa @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V", ordinal = 0)) - private void overrideChatBackgroundColor(DrawContext drawableHelper, int left, int top, int right, int bottom, int color) + private void tweakeroo$overrideChatBackgroundColor(DrawContext drawableHelper, int left, int top, int right, int bottom, int color) { if (FeatureToggle.TWEAK_CHAT_BACKGROUND_COLOR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java index 0cbb81d5a..c58fd89dc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java @@ -24,7 +24,7 @@ public abstract class MixinChatScreen @Mutable @Shadow private String originalChatText; @Inject(method = "removed", at = @At("HEAD")) - private void storeChatText(CallbackInfo ci) + private void tweakeroo$storeChatText(CallbackInfo ci) { if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue()) { @@ -33,7 +33,7 @@ private void storeChatText(CallbackInfo ci) } @Inject(method = "(Ljava/lang/String;)V", at = @At("RETURN")) - private void restoreText(String defaultText, CallbackInfo ci) + private void tweakeroo$restoreText(String defaultText, CallbackInfo ci) { if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && !MiscUtils.getLastChatText().isEmpty()) { @@ -48,13 +48,13 @@ private void restoreText(String defaultText, CallbackInfo ci) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = Shift.AFTER)) - private void onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) + private void tweakeroo$onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) { MiscUtils.setLastChatText(""); } @ModifyConstant(method = "render", constant = @Constant(intValue = Integer.MIN_VALUE)) - private int overrideChatBackgroundColor(int original) + private int tweakeroo$overrideChatBackgroundColor(int original) { if (FeatureToggle.TWEAK_CHAT_BACKGROUND_COLOR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java index b221ea30d..98e682827 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java @@ -12,7 +12,7 @@ public abstract class MixinChunkBuilder_BuiltChunk { @Inject(method = "isChunkNonEmpty", at = @At("HEAD"), cancellable = true) - private void allowEdgeChunksToRender(BlockPos pos, CallbackInfoReturnable cir) + private void tweakeroo$allowEdgeChunksToRender(BlockPos pos, CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_RENDER_EDGE_CHUNKS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java index bdff5c479..5eed08468 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java @@ -19,7 +19,7 @@ public abstract class MixinClientCommandSource { @Inject(method = "getBlockPositionSuggestions", at = @At("HEAD"), cancellable = true) - private void onGetBlockPositionSuggestions(CallbackInfoReturnable> cir) + private void tweakeroo$onGetBlockPositionSuggestions(CallbackInfoReturnable> cir) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -27,30 +27,30 @@ private void onGetBlockPositionSuggestions(CallbackInfoReturnable> cir) + private void tweakeroo$onGetPositionSuggestions(CallbackInfoReturnable> cir) { MinecraftClient mc = MinecraftClient.getInstance(); if (FeatureToggle.TWEAK_TAB_COMPLETE_COORDINATE.getBooleanValue() && mc.player != null && (mc.crosshairTarget == null || mc.crosshairTarget.getType() == HitResult.Type.MISS)) { - cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(formatDouble(mc.player.getX()), formatDouble(mc.player.getY()), formatDouble(mc.player.getZ())))); + cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(tweakeroo$formatDouble(mc.player.getX()), tweakeroo$formatDouble(mc.player.getY()), tweakeroo$formatDouble(mc.player.getZ())))); } } @Unique - private static String formatDouble(double val) + private static String tweakeroo$formatDouble(double val) { return String.format(Locale.ROOT, "%.2f", val); } @Unique - private static String formatInt(int val) + private static String tweakeroo$formatInt(int val) { return Integer.toString(val); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java index bcd919dab..dc7541828 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java @@ -19,7 +19,7 @@ public abstract class MixinClientPlayNetworkHandler value = "INVOKE", target = "Lnet/minecraft/screen/ScreenHandler;setStackInSlot(IILnet/minecraft/item/ItemStack;)V"), cancellable = true) - private void onHandleSetSlot(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) + private void tweakeroo$onHandleSetSlot(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) { if (PlacementTweaks.shouldSkipSlotSync(packet.getSlot(), packet.getStack())) { @@ -29,7 +29,7 @@ private void onHandleSetSlot(ScreenHandlerSlotUpdateS2CPacket packet, CallbackIn @Inject(method = "onDeathMessage", at = @At(value = "INVOKE", // onCombatEvent target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V")) - private void onPlayerDeath(DeathMessageS2CPacket packetIn, CallbackInfo ci) + private void tweakeroo$onPlayerDeath(DeathMessageS2CPacket packetIn, CallbackInfo ci) { MinecraftClient mc = MinecraftClient.getInstance(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java index c23fa0e6b..704e7deac 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java @@ -49,7 +49,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @Redirect(method = "updateNausea()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;shouldPause()Z")) - private boolean onDoesGuiPauseGame(Screen gui) + private boolean tweakeroo$onDoesGuiPauseGame(Screen gui) { // Spoof the return value to prevent entering the if block if (Configs.Disable.DISABLE_PORTAL_GUI_CLOSING.getBooleanValue()) @@ -61,7 +61,7 @@ private boolean onDoesGuiPauseGame(Screen gui) } @Inject(method = "updateNausea", at = @At("HEAD")) - private void disableNauseaEffectPre(CallbackInfo ci) + private void tweakeroo$disableNauseaEffectPre(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) { @@ -71,7 +71,7 @@ private void disableNauseaEffectPre(CallbackInfo ci) @Inject(method = "updateNausea", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;tickPortalCooldown()V")) - private void disableNauseaEffectPost(CallbackInfo ci) + private void tweakeroo$disableNauseaEffectPost(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) { @@ -86,7 +86,7 @@ private void disableNauseaEffectPost(CallbackInfo ci) @Inject(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;falling:Z")) - private void overrideSprint(CallbackInfo ci) + private void tweakeroo$overrideSprint(CallbackInfo ci) { if (FeatureToggle.TWEAK_PERMANENT_SPRINT.getBooleanValue() && ! this.isSprinting() && ! this.isUsingItem() && this.input.movementForward >= 0.8F && @@ -99,7 +99,7 @@ private void overrideSprint(CallbackInfo ci) @Redirect(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;horizontalCollision:Z")) - private boolean overrideCollidedHorizontally(ClientPlayerEntity player) + private boolean tweakeroo$overrideCollidedHorizontally(ClientPlayerEntity player) { if (Configs.Disable.DISABLE_WALL_UNSPRINT.getBooleanValue()) { @@ -114,7 +114,7 @@ private boolean overrideCollidedHorizontally(ClientPlayerEntity player) target = "Lnet/minecraft/client/option/GameOptions;sprintKey:Lnet/minecraft/client/option/KeyBinding;")), at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, ordinal = 0, shift = At.Shift.AFTER, target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksLeftToDoubleTapSprint:I")) - private void disableDoubleTapSprint(CallbackInfo ci) + private void tweakeroo$disableDoubleTapSprint(CallbackInfo ci) { if (Configs.Disable.DISABLE_DOUBLE_TAP_SPRINT.getBooleanValue()) { @@ -123,7 +123,7 @@ private void disableDoubleTapSprint(CallbackInfo ci) } @Inject(method = "tick", at = @At("HEAD")) - private void disableMovementInputsPre(CallbackInfo ci) + private void tweakeroo$disableMovementInputsPre(CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerMovement()) { @@ -133,7 +133,7 @@ private void disableMovementInputsPre(CallbackInfo ci) } @Inject(method = "tick", at = @At("RETURN")) - private void disableMovementInputsPost(CallbackInfo ci) + private void tweakeroo$disableMovementInputsPost(CallbackInfo ci) { if (this.realInput != null) { @@ -143,7 +143,7 @@ private void disableMovementInputsPost(CallbackInfo ci) } @Inject(method = "isCamera", at = @At("HEAD"), cancellable = true) - private void allowPlayerMovementInFreeCameraMode(CallbackInfoReturnable cir) + private void tweakeroo$allowPlayerMovementInFreeCameraMode(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && CameraEntity.originalCameraWasPlayer()) { @@ -152,7 +152,7 @@ private void allowPlayerMovementInFreeCameraMode(CallbackInfoReturnable } @Inject(method = "swingHand", at = @At("HEAD"), cancellable = true) - private void preventHandSwing(Hand hand, CallbackInfo ci) + private void tweakeroo$preventHandSwing(Hand hand, CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerInputs()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 937f3a4e9..218fe6404 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -36,7 +36,7 @@ public abstract class MixinClientPlayerInteractionManager value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), cancellable = true) - private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) + private void tweakeroo$onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -54,7 +54,7 @@ private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackIn "Lnet/minecraft/util/Hand;" + ")Lnet/minecraft/util/TypedActionResult;")), at = @At("RETURN")) - private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, + private void tweakeroo$onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, MutableObject mutableObject, int sequence, CallbackInfoReturnable> cir) { @@ -68,7 +68,7 @@ private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) + private void tweakeroo$onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -85,7 +85,7 @@ private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, H ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) + private void tweakeroo$onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -95,7 +95,7 @@ private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, E } @Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true) - private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) + private void tweakeroo$preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerInputs()) { @@ -118,7 +118,7 @@ else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" + "Lnet/minecraft/util/math/BlockPos;" + ")Lnet/minecraft/block/BlockState;", ordinal = 0)) - private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) + private void tweakeroo$onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) { if (this.client.player != null && this.client.world != null) { @@ -132,7 +132,7 @@ private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnabl } @Inject(method = "attackBlock", at = @At("HEAD"), cancellable = true) - private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) + private void tweakeroo$handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) @@ -146,7 +146,7 @@ private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackIn } @Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true) // MCP: onPlayerDamageBlock - private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) + private void tweakeroo$handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) @@ -160,7 +160,7 @@ private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackIn } @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) - private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) + private void tweakeroo$overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java index 0a2b7f28a..8efe72c60 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java @@ -35,7 +35,7 @@ private MixinClientWorld(MutableWorldProperties properties, } @Inject(method = "tickEntity", at = @At("HEAD"), cancellable = true) - private void disableClientEntityTicking(Entity entity, CallbackInfo ci) + private void tweakeroo$disableClientEntityTicking(Entity entity, CallbackInfo ci) { if (Configs.Disable.DISABLE_CLIENT_ENTITY_UPDATES.getBooleanValue() && (entity instanceof PlayerEntity) == false) @@ -66,7 +66,7 @@ private void fixChunkEntityLeak(WorldChunk chunk, CallbackInfo ci) */ @Inject(method = "scheduleBlockRerenderIfNeeded", at = @At("HEAD"), cancellable = true) - private void disableChunkReRenders(BlockPos pos, BlockState old, BlockState updated, CallbackInfo ci) + private void tweakeroo$disableChunkReRenders(BlockPos pos, BlockState old, BlockState updated, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { @@ -75,7 +75,7 @@ private void disableChunkReRenders(BlockPos pos, BlockState old, BlockState upda } @Inject(method = "scheduleBlockRenders", at = @At("HEAD"), cancellable = true) - private void disableChunkReRenders(int x, int y, int z, CallbackInfo ci) + private void tweakeroo$disableChunkReRenders(int x, int y, int z, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { @@ -84,7 +84,7 @@ private void disableChunkReRenders(int x, int y, int z, CallbackInfo ci) } @Inject(method = "updateListeners", at = @At("HEAD"), cancellable = true) - private void disableChunkReRenders(BlockPos pos, BlockState oldState, BlockState newState, int flags, CallbackInfo ci) + private void tweakeroo$disableChunkReRenders(BlockPos pos, BlockState oldState, BlockState newState, int flags, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java index c469127ad..1080ab047 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java @@ -12,7 +12,7 @@ public class MixinClientWorld_Properties { @Inject(method = "getSkyDarknessHeight", at = @At("HEAD"), cancellable = true) - private void tweakeroo_overrideSkyDarknessHeight(HeightLimitView world, CallbackInfoReturnable cir) + private void tweakeroo$overrideSkyDarknessHeight(HeightLimitView world, CallbackInfoReturnable cir) { // Disable the dark sky effect in normal situations // by moving the y threshold below the bottom of the world diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java index 77b1eaed4..ed492b1e4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java @@ -18,7 +18,7 @@ public abstract class MixinCloneCommand @Redirect(method = "execute", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getInt(Lnet/minecraft/world/GameRules$Key;)I")) - private static int tweakeroo_overrideBlockLimit(GameRules instance, Key rule) + private static int tweakeroo$overrideBlockLimit(GameRules instance, Key rule) { if (FeatureToggle.TWEAK_FILL_CLONE_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java index c2a75644d..89d9dfa30 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java @@ -45,7 +45,7 @@ public abstract class MixinCommandBlockScreen extends AbstractCommandBlockScreen private String lastName = ""; @Inject(method = "init", at = @At("RETURN")) - private void addExtraFields(CallbackInfo ci) + private void tweakeroo$addExtraFields(CallbackInfo ci) { if (FeatureToggle.TWEAK_COMMAND_BLOCK_EXTRA_FIELDS.getBooleanValue()) { @@ -116,7 +116,7 @@ public void tick() { String currentName = this.blockEntity.getCommandExecutor().getCustomName().getString(); - if (!currentName.equals(this.lastName)) + if (currentName.equals(this.lastName) == false) { this.textFieldName.setText(currentName); this.lastName = currentName; @@ -130,7 +130,7 @@ public void tick() if (this.updateExecValue != updateExec) { this.updateExecValue = updateExec; - Text str = getDisplayStringForCurrentStatus(this.updateExecValue); + Text str = tweakeroo$getDisplayStringForCurrentStatus(this.updateExecValue); this.buttonUpdateExec.setMessage(str); this.buttonUpdateExec.setWidth(this.textRenderer.getWidth(str) + 10); } @@ -155,7 +155,7 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float partia } @Unique - private static Text getDisplayStringForCurrentStatus(boolean updateExecValue) + private static Text tweakeroo$getDisplayStringForCurrentStatus(boolean updateExecValue) { String translationKey = "tweakeroo.gui.button.misc.command_block.update_execution"; boolean isCurrentlyOn = ! updateExecValue; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java index cefd1f18a..b43738130 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java @@ -22,7 +22,7 @@ private MixinCreativeInventoryScreen(CreativeInventoryScreen.CreativeScreenHandl // This needs to happen before the `this.handler.scrollItems(0.0F);` call. @Inject(method = "search", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/CreativeInventoryScreen$CreativeScreenHandler;scrollItems(F)V")) - private void tweakeroo_removeInfestedStoneFromCreativeSearchInventory(CallbackInfo ci) + private void tweakeroo$removeInfestedStoneFromCreativeSearchInventory(CallbackInfo ci) { if (Configs.Disable.DISABLE_CREATIVE_INFESTED_BLOCKS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java index d9a632eba..f0e092c42 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java @@ -17,7 +17,7 @@ private MixinDimensionEffects_Nether(float cloudsHeight, boolean alternateSkyCol } @Inject(method = "useThickFog", at = @At("HEAD"), cancellable = true) - private void disableNetherFog(int x, int z, CallbackInfoReturnable cir) + private void tweakeroo$disableNetherFog(int x, int z, CallbackInfoReturnable cir) { if (Configs.Disable.DISABLE_NETHER_FOG.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index f2de467fd..5295eb452 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -32,7 +33,7 @@ public abstract class MixinEntity @Shadow public abstract void setVelocity(net.minecraft.util.math.Vec3d velocity); @Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true) - private void overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntity player, CallbackInfoReturnable cir) + private void tweakeroo$overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntity player, CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_RENDER_INVISIBLE_ENTITIES.getBooleanValue()) { @@ -41,10 +42,13 @@ private void overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntit } @Inject(method = "updateVelocity", at = @At("HEAD"), cancellable = true) - private void moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec3d motion, CallbackInfo ci) + private void tweakeroo$moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec3d motion, CallbackInfo ci) { + Tweakeroo.debugLog("tweakeroo$moreAccurateMoveRelative(): pre"); + // TODO I'm not sure why IntelliJ is greying this out if the code is correct? --> TEST if ((Object) this instanceof ClientPlayerEntity) { + Tweakeroo.debugLog("tweakeroo$moreAccurateMoveRelative(): post"); if (FeatureToggle.TWEAK_SNAP_AIM.getBooleanValue()) { double speed = motion.lengthSquared(); @@ -65,10 +69,14 @@ private void moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec } @Inject(method = "changeLookDirection", at = @At("HEAD"), cancellable = true) - private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) + private void tweakeroo$overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) { + Tweakeroo.debugLog("tweakeroo$overrideYaw(): pre"); + // TODO I'm not sure why IntelliJ is greying this out if the code is correct? --> TEST if ((Object) this instanceof ClientPlayerEntity) { + Tweakeroo.debugLog("tweakeroo$overrideYaw(): post"); + if (CameraUtils.shouldPreventPlayerMovement()) { CameraUtils.updateCameraRotations((float) yawChange, (float) pitchChange); @@ -96,7 +104,7 @@ private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) // Not locked, or not snapping the pitch (ie. not in Pitch or Both modes) boolean updatePitch = snapAimLock == false || mode == SnapAimMode.YAW; - this.updateCustomPlayerRotations(yawChange, pitchChange, updateYaw, updatePitch, pitchLimit); + this.tweakeroo$updateCustomPlayerRotations(yawChange, pitchChange, updateYaw, updatePitch, pitchLimit); this.yaw = MiscUtils.getSnappedYaw(this.forcedYaw); this.pitch = MiscUtils.getSnappedPitch(this.forcedPitch); @@ -117,7 +125,7 @@ private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) { int pitchLimit = Configs.Generic.SNAP_AIM_PITCH_OVERSHOOT.getBooleanValue() ? 180 : 90; - this.updateCustomPlayerRotations(yawChange, pitchChange, true, true, pitchLimit); + this.tweakeroo$updateCustomPlayerRotations(yawChange, pitchChange, true, true, pitchLimit); CameraUtils.setCameraYaw((float) this.forcedYaw); CameraUtils.setCameraPitch((float) this.forcedPitch); @@ -139,7 +147,7 @@ private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) } @Unique - private void updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) + private void tweakeroo$updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) { if (updateYaw) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java index b97cc9b1e..033b555ed 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java @@ -21,7 +21,7 @@ public abstract class MixinEntityRenderDispatcher { @Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true) - private void onShouldRender(Entity entityIn, Frustum frustum, double camX, double camY, double camZ, CallbackInfoReturnable cir) + private void tweakeroo$onShouldRender(Entity entityIn, Frustum frustum, double camX, double camY, double camZ, CallbackInfoReturnable cir) { if (Configs.Disable.DISABLE_ENTITY_RENDERING.getBooleanValue() && (entityIn instanceof PlayerEntity) == false) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java index 4b04c590d..80be99b9c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java @@ -11,13 +11,10 @@ @Mixin(Explosion.class) public abstract class MixinExplosion { - /** - * I don't know how long this was broken (1.20.4 also?), but let's fix it. - */ @ModifyArg(method = "affectWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V")) - private ParticleEffect addParticleModify(ParticleEffect parameters) + private ParticleEffect tweakeroo$addParticleModify(ParticleEffect parameters) { if (FeatureToggle.TWEAK_EXPLOSION_REDUCED_PARTICLES.getBooleanValue()) { @@ -28,12 +25,3 @@ private ParticleEffect addParticleModify(ParticleEffect parameters) } } -/* -@Redirect(method = "affectWorld", - slice = @Slice( - from = @At("HEAD"), - to = @At(value = "FIELD", - target = "Lnet/minecraft/world/explosion/Explosion;affectedBlocks:Lit/unimi/dsi/fastutil/objects/ObjectArrayList;")), - at = @At(value = "FIELD", - target = "Lnet/minecraft/particle/ParticleTypes;EXPLOSION_EMITTER:Lnet/minecraft/particle/DefaultParticleType;")) - */ \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java index c361c4e0d..3c6aa9e06 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java @@ -18,7 +18,7 @@ public abstract class MixinFillCommand @Redirect(method = "execute", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getInt(Lnet/minecraft/world/GameRules$Key;)I")) - private static int tweakeroo_overrideBlockLimit(GameRules instance, Key rule) + private static int tweakeroo$overrideBlockLimit(GameRules instance, Key rule) { if (FeatureToggle.TWEAK_FILL_CLONE_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index 53f120bd3..62d3cb407 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -41,7 +41,7 @@ public abstract class MixinGameRenderer private float realPitch; @Inject(method = "renderWorld", at = @At("HEAD"), cancellable = true) - private void onRenderWorld(CallbackInfo ci) + private void tweakeroo$onRenderWorld(CallbackInfo ci) { if (Callbacks.skipWorldRendering) { @@ -51,16 +51,16 @@ private void onRenderWorld(CallbackInfo ci) @Redirect(method = "renderWorld", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) - private void disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) + private void tweakeroo$disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) { - if (!Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue()) + if (Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue() == false) { this.bobView(matrices, tickDelta); } } @Inject(method = "getFov", at = @At("HEAD"), cancellable = true) - private void applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) + private void tweakeroo$applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) { if (MiscUtils.isZoomActive()) { @@ -72,10 +72,9 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) } } - // Method renamed @Redirect(method = "updateCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;")) - private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) + private Entity tweakeroo$overrideCameraEntityForRayTrace(MinecraftClient mc) { // Return the real player for the hit target ray tracing if the // player inputs option is enabled in Free Camera mode. @@ -91,7 +90,6 @@ private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) return mc.getCameraEntity(); } - // Call moved to findCrosshairTarget() @ModifyArg(method = "findCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/ProjectileUtil;raycast(" + @@ -101,17 +99,17 @@ private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) "Lnet/minecraft/util/math/Box;" + "Ljava/util/function/Predicate;D)" + "Lnet/minecraft/util/hit/EntityHitResult;")) - private Predicate overrideTargetedEntityCheck(Predicate predicate) + private Predicate tweakeroo$overrideTargetedEntityCheck(Predicate predicate) { if (Configs.Disable.DISABLE_DEAD_MOB_TARGETING.getBooleanValue()) { - predicate = predicate.and((entityIn) -> !(entityIn instanceof LivingEntity) || ((LivingEntity) entityIn).getHealth() > 0f); + predicate = predicate.and((entityIn) -> (entityIn instanceof LivingEntity) == false || ((LivingEntity) entityIn).getHealth() > 0f); } if ((FeatureToggle.TWEAK_HANGABLE_ENTITY_BYPASS.getBooleanValue() && this.client.player != null && this.client.player.isSneaking() == Configs.Generic.HANGABLE_ENTITY_BYPASS_INVERSE.getBooleanValue())) { - predicate = predicate.and((entityIn) -> !(entityIn instanceof AbstractDecorationEntity)); + predicate = predicate.and((entityIn) -> (entityIn instanceof AbstractDecorationEntity) == false); } return predicate; @@ -120,7 +118,7 @@ private Predicate overrideTargetedEntityCheck(Predicate predicat @Inject(method = "renderWorld", at = @At( value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/render/GameRenderer;updateCrosshairTarget(F)V")) - private void overrideRenderViewEntityPre(CallbackInfo ci) + private void tweakeroo$overrideRenderViewEntityPre(CallbackInfo ci) { if (FeatureToggle.TWEAK_ELYTRA_CAMERA.getBooleanValue() && Hotkeys.ELYTRA_CAMERA.getKeybind().isKeybindHeld()) { @@ -136,7 +134,7 @@ private void overrideRenderViewEntityPre(CallbackInfo ci) } @Inject(method = "renderWorld", at = @At("RETURN")) - private void overrideRenderViewEntityPost(CallbackInfo ci) + private void tweakeroo$overrideRenderViewEntityPost(CallbackInfo ci) { if (FeatureToggle.TWEAK_ELYTRA_CAMERA.getBooleanValue() && Hotkeys.ELYTRA_CAMERA.getKeybind().isKeybindHeld()) { @@ -150,7 +148,7 @@ private void overrideRenderViewEntityPost(CallbackInfo ci) } @Inject(method = "renderHand", at = @At("HEAD"), cancellable = true) - private void removeHandRendering(CallbackInfo ci) + private void tweakeroo$removeHandRendering(CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java index 41a4b1ad3..34d80553d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java @@ -26,7 +26,7 @@ public float redirectedGetCooledAttackStrength(ClientPlayerEntity player, float } @Inject(method = "renderFirstPersonItem", at = @At("HEAD"), cancellable = true) - private void preventOffhandRendering(AbstractClientPlayerEntity player, float tickDelta, + private void tweakeroo$preventOffhandRendering(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index fe6131139..e384cc9d2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -28,7 +28,7 @@ public abstract class MixinInGameHud @Shadow @Final private MinecraftClient client; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) - private void overridePlayerForRendering(CallbackInfoReturnable cir) + private void tweakeroo$overridePlayerForRendering(CallbackInfoReturnable cir) { // Fix the hotbar rendering in the Free Camera mode by using the actual player if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) @@ -40,7 +40,7 @@ private void overridePlayerForRendering(CallbackInfoReturnable cir @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) - private void overrideCursorRender(CallbackInfo ci) + private void tweakeroo$overrideCursorRender(CallbackInfo ci) { if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { @@ -53,7 +53,7 @@ private void overrideCursorRender(CallbackInfo ci) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", ordinal = 1, shift = At.Shift.AFTER)) - private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) + private void tweakeroo$alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) { if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { @@ -66,7 +66,7 @@ private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, Ca } @Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true) - private void disableScoreboardRendering(CallbackInfo ci) + private void tweakeroo$disableScoreboardRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) { @@ -75,7 +75,7 @@ private void disableScoreboardRendering(CallbackInfo ci) } @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) - private void disableStatusEffectHudRendering(CallbackInfo ci) + private void tweakeroo$disableStatusEffectHudRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index 68edb9279..35e6750b0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -17,7 +17,7 @@ public abstract class MixinItem implements IItemStackLimit /* // TODO 1.19.3+ @Inject(method = "getGroup", at = @At("HEAD"), cancellable = true) - private void overrideItemGroup(CallbackInfoReturnable cir) + private void tweakeroo$overrideItemGroup(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CREATIVE_EXTRA_ITEMS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 767c9b2ef..8a16a0ade 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -1,5 +1,7 @@ package fi.dy.masa.tweakeroo.mixin; +import fi.dy.masa.tweakeroo.Tweakeroo; +import fi.dy.masa.tweakeroo.config.Configs; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -39,7 +41,7 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) } @Inject(method = "(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", at = @At("RETURN")) - private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) + private void tweakeroo$removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) { if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { @@ -54,7 +56,7 @@ private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double } @Inject(method = "canMerge()Z", at = @At("HEAD"), cancellable = true) - private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) + private void tweakeroo$allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { @@ -66,7 +68,7 @@ private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) && this.pickupDelay != 32767 && this.itemAge != -32768 && this.itemAge < 6000 - && stack.getCount() < 64; + && stack.getCount() < Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue(); cir.setReturnValue(canMerge); } @@ -74,22 +76,25 @@ private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) } @Inject(method = "tryMerge(Lnet/minecraft/entity/ItemEntity;)V", at = @At("HEAD"), cancellable = true) - private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) + private void tweakeroo$stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) { + Tweakeroo.debugLog("tweakeroo$stackEmptyShulkerBoxes(): pre"); + // TODO I don't know why IntelliJ greys this out. --> TEST if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { ItemEntity self = (ItemEntity) (Object) this; + Tweakeroo.debugLog("tweakeroo$stackEmptyShulkerBoxes(): post"); ItemStack stackSelf = self.getStack(); ItemStack stackOther = other.getStack(); if (stackSelf.getItem() instanceof BlockItem && ((BlockItem) stackSelf.getItem()).getBlock() instanceof ShulkerBoxBlock && stackSelf.getItem() == stackOther.getItem() && - !fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) && + fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) == false && // Only stack up to 64, and don't steal from other stacks that are larger - stackSelf.getCount() < 64 && stackSelf.getCount() >= stackOther.getCount() && + stackSelf.getCount() < Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue() && stackSelf.getCount() >= stackOther.getCount() && ItemStack.areItemsAndComponentsEqual(stackSelf, stackOther)) { - int amount = Math.min(stackOther.getCount(), 64 - stackSelf.getCount()); + int amount = Math.min(stackOther.getCount(), Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue() - stackSelf.getCount()); stackSelf.increment(amount); self.setStack(stackSelf); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java index b8e26c1c9..7769372ed 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java @@ -7,7 +7,7 @@ public abstract class MixinItemGroup { /* // TODO 1.19.3+ @Inject(method = "appendStacks", at = @At("RETURN")) - private void appendCustomItems(net.minecraft.util.collection.DefaultedList stacks, CallbackInfo ci) + private void tweakeroo$appendCustomItems(net.minecraft.util.collection.DefaultedList stacks, CallbackInfo ci) { if (FeatureToggle.TWEAK_CREATIVE_EXTRA_ITEMS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index 0063b9696..bfbad5a91 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -16,7 +16,7 @@ public abstract class MixinItemStack public abstract Item getItem(); @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) - public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) + public void tweakeroo$getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) { ci.setReturnValue(((IItemStackLimit) this.getItem()).tweakeroo$getMaxStackSize((ItemStack) (Object) this)); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java index a5b79f484..7a5abdcd0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java @@ -22,7 +22,7 @@ public abstract class MixinKeyboardInput extends Input ordinal = 0, shift = Shift.AFTER, opcode = Opcodes.PUTFIELD)) - private void customMovement(boolean val1, float f, CallbackInfo ci) + private void tweakeroo$customMovement(boolean val1, float f, CallbackInfo ci) { if (FeatureToggle.TWEAK_MOVEMENT_KEYS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java index 3ce40b1b3..9aec67fbc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java @@ -19,11 +19,11 @@ public abstract class MixinLightingProvider @Shadow @Final @Nullable private ChunkLightProvider blockLightProvider; @Inject(method = "checkBlock", at = @At("HEAD"), cancellable = true) - private void disableLightUpdates(BlockPos pos, CallbackInfo ci) + private void tweakeroo$disableLightUpdates(BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_CLIENT_LIGHT_UPDATES.getBooleanValue() && this.blockLightProvider != null && - ((IMixinChunkLightProvider) this.blockLightProvider).tweakeroo_getChunkProvider().getWorld() == MinecraftClient.getInstance().world) + ((IMixinChunkLightProvider) this.blockLightProvider).tweakeroo$getChunkProvider().getWorld() == MinecraftClient.getInstance().world) { ci.cancel(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index 44ad756c9..e2a5a7179 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -26,33 +27,48 @@ private MixinLivingEntity(EntityType type, World worldIn) @Redirect(method = "travel", at = @At(value = "FIELD", ordinal = 1, target = "Lnet/minecraft/world/World;isClient:Z")) - private boolean fixElytraLanding(World world) + private boolean tweakeroo$fixElytraLanding(World world) { - return world.isClient && (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || ((Object) this instanceof ClientPlayerEntity) == false); + return world.isClient && + (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || + ((Object) this instanceof ClientPlayerEntity) == false); } @Inject(method = "tickStatusEffects", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/entity/data/DataTracker;get(Lnet/minecraft/entity/data/TrackedData;)Ljava/lang/Object;"), cancellable = true) - private void removeOwnPotionEffects(CallbackInfo ci) + private void tweakeroo$removeOwnPotionEffects(CallbackInfo ci) { - MinecraftClient mc = MinecraftClient.getInstance(); - - if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue() && - ((Object) this) == mc.player && mc.options.getPerspective() == Perspective.FIRST_PERSON) + if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue()) { - ci.cancel(); + Tweakeroo.debugLog("tweakeroo$removeOwnPotionEffects(): pre"); + + // TODO I don't know why IntelliJ is greying this out. --> TEST + if (((Object) this) instanceof ClientPlayerEntity) + { + Tweakeroo.debugLog("tweakeroo$removeOwnPotionEffects(): post"); + if (MinecraftClient.getInstance().options.getPerspective() == Perspective.FIRST_PERSON) + { + ci.cancel(); + } + } } } @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;tickFallFlying()V")) - private void tweakeroo_applyCustomDeceleration(CallbackInfo ci) + private void tweakeroo$applyCustomDeceleration(CallbackInfo ci) { - if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue() && - ((Entity) this) == MinecraftClient.getInstance().player) + if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue()) { - MiscUtils.handlePlayerDeceleration(); + Tweakeroo.debugLog("tweakeroo$applyCustomDeceleration(): pre"); + + // TODO I don't know why IntelliJ is greying this out. --> TEST + if (((Object) this) instanceof ClientPlayerEntity) + { + Tweakeroo.debugLog("tweakeroo$applyCustomDeceleration(): post"); + MiscUtils.handlePlayerDeceleration(); + } } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java index 4bbdee519..00226701b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java @@ -60,7 +60,7 @@ public void tweakeroo_invokeDoItemUse() } @Inject(method = "render", at = @At("RETURN")) - private void onGameLoop(boolean renderWorld, CallbackInfo ci) + private void tweakeroo$onGameLoop(boolean renderWorld, CallbackInfo ci) { if (this.player != null && this.world != null) { @@ -78,7 +78,7 @@ private void onGameLoop(boolean renderWorld, CallbackInfo ci) "Lnet/minecraft/util/math/BlockPos;" + "Lnet/minecraft/util/math/Direction;)Z") }) - private void onLeftClickMousePre(CallbackInfoReturnable cir) + private void tweakeroo$onLeftClickMousePre(CallbackInfoReturnable cir) { PlacementTweaks.onLeftClickMousePre(); } @@ -86,7 +86,7 @@ private void onLeftClickMousePre(CallbackInfoReturnable cir) @Inject(method = "doAttack", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) - private void onLeftClickMousePost(CallbackInfoReturnable cir) + private void tweakeroo$onLeftClickMousePost(CallbackInfoReturnable cir) { PlacementTweaks.onLeftClickMousePost(); } @@ -98,7 +98,7 @@ private void onLeftClickMousePost(CallbackInfoReturnable cir) "Lnet/minecraft/util/Hand;" + "Lnet/minecraft/util/hit/BlockHitResult;" + ")Lnet/minecraft/util/ActionResult;")) - private ActionResult onProcessRightClickBlock( + private ActionResult tweakeroo$onProcessRightClickBlock( ClientPlayerInteractionManager controller, ClientPlayerEntity player, Hand hand, @@ -108,7 +108,7 @@ private ActionResult onProcessRightClickBlock( } @Inject(method = "handleInputEvents", at = @At("HEAD")) - private void onProcessKeybindsPre(CallbackInfo ci) + private void tweakeroo$onProcessKeybindsPre(CallbackInfo ci) { if (this.currentScreen == null) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java index 3fe75fe16..3266d20e5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java @@ -12,7 +12,7 @@ public abstract class MixinMobSpawnerBlockEntityRenderer { @Inject(method = "render(Lnet/minecraft/block/entity/MobSpawnerBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) - private void cancelRender(CallbackInfo ci) + private void tweakeroo$cancelRender(CallbackInfo ci) { if (Configs.Disable.DISABLE_MOB_SPAWNER_MOB_RENDER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java index c74c377af..bd3c4dfa2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java @@ -15,7 +15,7 @@ public abstract class MixinMobSpawnerLogic { @Inject(method = "clientTick", at = @At("HEAD"), cancellable = true) - private void cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) + private void tweakeroo$cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_MOB_SPAWNER_MOB_RENDER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java index 941125bc0..09d9c9239 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java @@ -11,7 +11,7 @@ public abstract class MixinMouse { @ModifyVariable(method = "onMouseScroll", ordinal = 1, at = @At("HEAD"), argsOnly = true) - private double applyHorizontalScroll(double vertical, long argWindow, double argHorizontal, double argVertical) + private double tweakeroo$applyHorizontalScroll(double vertical, long argWindow, double argHorizontal, double argVertical) { if (Configs.Fixes.MAC_HORIZONTAL_SCROLL.getBooleanValue() && MinecraftClient.IS_SYSTEM_MAC && vertical == 0) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java index 15f182404..176a1eb53 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java @@ -14,10 +14,10 @@ public abstract class MixinNetherPortalBlock { @Redirect(method = "randomDisplayTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFZ)V")) - private void tweakeroo_disablePortalSound(World instance, double x, double y, double z, SoundEvent sound, + private void tweakeroo$disablePortalSound(World instance, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean useDistance) { - if (!Configs.Disable.DISABLE_NETHER_PORTAL_SOUND.getBooleanValue()) + if (Configs.Disable.DISABLE_NETHER_PORTAL_SOUND.getBooleanValue() == false) { instance.playSound(x, y, z, sound, category, volume, pitch, useDistance); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java index 377dc98db..69581e721 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java @@ -20,7 +20,7 @@ public MixinObserverBlock(Block.Settings builder) } @Inject(method = "scheduleTick", at = @At("HEAD"), cancellable = true) - private void preventTrigger(WorldAccess worldIn, BlockPos pos, CallbackInfo ci) + private void tweakeroo$preventTrigger(WorldAccess worldIn, BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_OBSERVER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java index 1358573f5..3a7b6862e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java @@ -14,7 +14,7 @@ public abstract class MixinParticleManager { @Inject(method = "addBlockBreakParticles", at = @At("HEAD"), cancellable = true) - private void onAddBlockDestroyEffects(BlockPos pos, BlockState state, CallbackInfo ci) + private void tweakeroo$onAddBlockDestroyEffects(BlockPos pos, BlockState state, CallbackInfo ci) { if (Configs.Disable.DISABLE_BLOCK_BREAK_PARTICLES.getBooleanValue()) { @@ -23,7 +23,7 @@ private void onAddBlockDestroyEffects(BlockPos pos, BlockState state, CallbackIn } @Inject(method = "addParticle(Lnet/minecraft/client/particle/Particle;)V", at = @At("HEAD"), cancellable = true) - private void disableAllParticles(Particle effect, CallbackInfo ci) + private void tweakeroo$disableAllParticles(Particle effect, CallbackInfo ci) { if (Configs.Disable.DISABLE_PARTICLES.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java index c28a2a694..a047843e9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java @@ -14,7 +14,7 @@ public abstract class MixinPlayerAbilities { @Inject(method = "getFlySpeed", at = @At("HEAD"), cancellable = true) - private void overrideFlySpeed(CallbackInfoReturnable cir) + private void tweakeroo$overrideFlySpeed(CallbackInfoReturnable cir) { PlayerEntity player = MinecraftClient.getInstance().player; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index c4334c99b..cafc439d4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.server.MinecraftServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -26,7 +27,7 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor } @Inject(method = "method_30263", at = @At("HEAD"), cancellable = true) - private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) + private void tweakeroo$restore_1_15_2_sneaking(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) { @@ -35,32 +36,61 @@ private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) } @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", - target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) - private boolean fakeSneaking(PlayerEntity entity) + target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) + private boolean tweakeroo$fakeSneaking(PlayerEntity entity) { - if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) + if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue()) { - return true; + if ((Object) this instanceof ClientPlayerEntity) + { + return true; + } } return this.clipAtLedge(); } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideBlockReachDistance(CallbackInfoReturnable cir) + private void tweakeroo$overrideBlockReachDistance(CallbackInfoReturnable cir) { + MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + if (server != null) + { + // For Single Player, use the configured value. + cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); + } + else + { + double rangeRealMax = cir.getReturnValue() + 1.0; + + // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. + cir.setReturnValue(Math.min(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); + // TODO this should be synchronized via ServUX + } } } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void overrideEntityReachDistance(CallbackInfoReturnable cir) + private void tweakeroo$overrideEntityReachDistance(CallbackInfoReturnable cir) { + MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + if (server != null) + { + // For Single Player, use the configured value. + cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); + } + else + { + double rangeRealMax = cir.getReturnValue() + 1.0; + + // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. + cir.setReturnValue(Math.min(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); + // TODO this should be synchronized via ServUX + } } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java index a8829a712..d228a740a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java @@ -5,7 +5,7 @@ public abstract class MixinPresetsScreen { /* @Inject(method = "init", at = @At("HEAD")) - private void addCustomEntries(CallbackInfo ci) + private void tweakeroo$addCustomEntries(CallbackInfo ci) { if (FeatureToggle.TWEAK_CUSTOM_FLAT_PRESETS.getBooleanValue()) { @@ -23,7 +23,7 @@ private void addCustomEntries(CallbackInfo ci) { String str = presetStrings.get(i); - if (this.registerPresetFromString(str) && PRESETS.size() > vanillaEntries) + if (this.tweakeroo$registerPresetFromString(str) && PRESETS.size() > vanillaEntries) { Object o = PRESETS.remove(PRESETS.size() - 1); PRESETS.add(0, o); @@ -32,7 +32,8 @@ private void addCustomEntries(CallbackInfo ci) } } - private boolean registerPresetFromString(String str) + @Unique + private boolean tweakeroo$registerPresetFromString(String str) { Matcher matcher = MiscUtils.PATTERN_WORLD_PRESET.matcher(str); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java index 4e559b49d..c8af11305 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java @@ -12,11 +12,11 @@ public abstract class MixinRavagerEntity @Redirect(method = "tickMovement", at = @At( value = "FIELD", target = "Lnet/minecraft/entity/mob/RavagerEntity;horizontalCollision:Z")) - private boolean fixDontBreakBlocksOnClient(RavagerEntity entity) + private boolean tweakeroo$fixDontBreakBlocksOnClient(RavagerEntity entity) { if (Configs.Fixes.RAVAGER_CLIENT_BLOCK_BREAK_FIX.getBooleanValue()) { - return entity.horizontalCollision && !entity.getEntityWorld().isClient; + return entity.horizontalCollision && entity.getEntityWorld().isClient == false; } return entity.horizontalCollision; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java index ec82e3a2a..f7763a89c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java @@ -12,7 +12,7 @@ public abstract class MixinSculkSensor { @Inject(method = "getCooldownTime", at = @At(value = "HEAD"), require = 0, cancellable = true) - private void modifyPulseLength(CallbackInfoReturnable cir) + private void tweakeroo$modifyPulseLength(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SCULK_PULSE_LENGTH.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java index a30648d4c..4f02e0789 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java @@ -13,7 +13,7 @@ public class MixinServerPlayNetworkHandler @Redirect(method = "onPlayerInteractBlock", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;subtract(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;")) - private Vec3d tweakeroo_removeHitPosCheck(Vec3d hitVec, Vec3d blockCenter) + private Vec3d tweakeroo$removeHitPosCheck(Vec3d hitVec, Vec3d blockCenter) { if (Configs.Generic.ITEM_USE_PACKET_CHECK_BYPASS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index efba720d3..cb2ab4d9d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -1,7 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; import java.util.List; - import net.minecraft.client.item.TooltipType; import net.minecraft.item.Item; import org.spongepowered.asm.mixin.Mixin; @@ -17,7 +16,7 @@ public abstract class MixinShulkerBoxBlock { @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) + private void tweakeroo$removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) { if (Configs.Disable.DISABLE_SHULKER_BOX_TOOLTIP.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index 71467501e..ffaa0438a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import fi.dy.masa.tweakeroo.Tweakeroo; import net.minecraft.registry.RegistryWrapper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -34,16 +35,22 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP } @Inject(method = "readNbt", at = @At("RETURN")) - private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) + private void tweakeroo$restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) { // Restore the copied/pasted text after the TileEntity sync overrides it with empty lines if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue() && this.getWorld() != null && this.getWorld().isClient) { MinecraftClient mc = MinecraftClient.getInstance(); - if ((mc.currentScreen instanceof SignEditScreen) && ((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) + if (mc.currentScreen instanceof SignEditScreen) { - MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); + Tweakeroo.debugLog("tweakeroo$restoreCopiedText(): pre"); + // TODO I do not know why IntelliJ is greying this out. --> TEST + if (((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) + { + Tweakeroo.debugLog("tweakeroo$restoreCopiedText(): post"); + MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); + } } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java index 50a470b8f..53919af5c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java @@ -25,7 +25,7 @@ public MixinSlimeBlock(AbstractBlock.Settings settings) } @Inject(method = "onSteppedOn", at = @At("HEAD"), cancellable = true) - private void onEntityWalkOnSlime(World worldIn, BlockPos pos, BlockState state, Entity entityIn, CallbackInfo ci) + private void tweakeroo$onEntityWalkOnSlime(World worldIn, BlockPos pos, BlockState state, Entity entityIn, CallbackInfo ci) { if (Configs.Disable.DISABLE_SLIME_BLOCK_SLOWDOWN.getBooleanValue() && entityIn instanceof PlayerEntity) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java index 5b87f9a9f..f1ad8a75f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Objects; import java.util.stream.Stream; + +import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; @@ -37,7 +39,7 @@ private MixinStructureBlockBlockEntity(BlockEntityType blockEntityType, Block to = @At(value = "FIELD", target = "Lnet/minecraft/block/entity/StructureBlockBlockEntity;size:Lnet/minecraft/util/math/Vec3i;")), constant = { @Constant(intValue = -48), @Constant(intValue = 48) }, require = 0) - private int overrideMaxSize(int original) + private int tweakeroo$overrideMaxSize(int original) { if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { @@ -49,13 +51,16 @@ private int overrideMaxSize(int original) } @Inject(method = "streamCornerPos", at = @At("HEAD"), cancellable = true) - private void overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoReturnable> cir) + private void tweakeroo$overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoReturnable> cir) { + Tweakeroo.debugLog("tweakeroo$overrideCornerBlockScan(): pre"); + // TODO I do not know why IntelliJ is greying this out. --> TEST if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { BlockPos pos = this.getPos(); World world = this.getWorld(); String name = ((StructureBlockBlockEntity) (Object) this).getTemplateName(); + Tweakeroo.debugLog("tweakeroo$overrideCornerBlockScan(): post"); int maxSize = Configs.Generic.STRUCTURE_BLOCK_MAX_SIZE.getIntegerValue(); int maxOffset = 48; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java index 6c2c260e3..af6700479 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java @@ -23,7 +23,7 @@ public abstract class MixinTeleportSpectatorMenu @Shadow @Final @Mutable private List elements; @Inject(method = "(Ljava/util/Collection;)V", at = @At("RETURN")) - private void allowSpectatorTeleport(Collection profiles, CallbackInfo ci) + private void tweakeroo$allowSpectatorTeleport(Collection profiles, CallbackInfo ci) { if (FeatureToggle.TWEAK_SPECTATOR_TELEPORT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java index 27cd43ff9..5839d459c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java @@ -13,7 +13,7 @@ public abstract class MixinThreadedAnvilChunkStorage { @Inject(method = "unloadChunks", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;chunkHolders:Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;")) - private void tweakeroo_disableSaving20ChunksEveryTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) + private void tweakeroo$disableSaving20ChunksEveryTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) { if (Configs.Disable.DISABLE_CONSTANT_CHUNK_SAVING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java index 782bca675..bffb26ea2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java @@ -16,7 +16,7 @@ public abstract class MixinTradeOffer @Shadow @Mutable @Final private int maxUses; @Inject(method = "use", at = @At("RETURN")) - private void preventTradeLocking(CallbackInfo ci) + private void tweakeroo$preventTradeLocking(CallbackInfo ci) { if (Configs.Disable.DISABLE_VILLAGER_TRADE_LOCKING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java index 633014fed..f91d983a2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java @@ -19,7 +19,7 @@ public abstract class MixinUpdateStructureBlockC2SPacket to = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/network/packet/c2s/play/UpdateStructureBlockC2SPacket;mirror:Lnet/minecraft/util/BlockMirror;")), constant = { @Constant(intValue = -48), @Constant(intValue = 48) }, require = 0) - private int tweakeroo_overrideStructureBlockSizeLimit(int original) + private int tweakeroo$overrideStructureBlockSizeLimit(int original) { if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java index e984386d5..6df76f76a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java @@ -20,7 +20,7 @@ public abstract class MixinWindow @Shadow public abstract int getHeight(); @Inject(method = "getScaleFactor", at = @At("HEAD"), cancellable = true) - private void tweakeroo_customGuiScaleGetScale(CallbackInfoReturnable cir) + private void tweakeroo$customGuiScaleGetScale(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) @@ -35,7 +35,7 @@ private void tweakeroo_customGuiScaleGetScale(CallbackInfoReturnable cir } @Inject(method = "getScaledWidth", at = @At("HEAD"), cancellable = true) - private void tweakeroo_customGuiScaleGetWidth(CallbackInfoReturnable cir) + private void tweakeroo$customGuiScaleGetWidth(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) @@ -50,7 +50,7 @@ private void tweakeroo_customGuiScaleGetWidth(CallbackInfoReturnable ci } @Inject(method = "getScaledHeight", at = @At("HEAD"), cancellable = true) - private void tweakeroo_customGuiScaleGetHeight(CallbackInfoReturnable cir) + private void tweakeroo$customGuiScaleGetHeight(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java index 339ac4367..2c3690ebf 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java @@ -14,7 +14,7 @@ public abstract class MixinWorld { @Inject(method = "tickBlockEntities", at = @At("HEAD"), cancellable = true) - private void disableBlockEntityTicking(CallbackInfo ci) + private void tweakeroo$disableBlockEntityTicking(CallbackInfo ci) { if (Configs.Disable.DISABLE_TILE_ENTITY_TICKING.getBooleanValue()) { @@ -23,9 +23,9 @@ private void disableBlockEntityTicking(CallbackInfo ci) } @Inject(method = "tickEntity(Ljava/util/function/Consumer;Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true) - private void preventEntityTicking(Consumer consumer, T entityIn, CallbackInfo ci) + private void tweakeroo$preventEntityTicking(Consumer consumer, T entityIn, CallbackInfo ci) { - if (Configs.Disable.DISABLE_ENTITY_TICKING.getBooleanValue() && !(entityIn instanceof PlayerEntity)) + if (Configs.Disable.DISABLE_ENTITY_TICKING.getBooleanValue() && (entityIn instanceof PlayerEntity) == false) { ci.cancel(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index 3f8a7039c..01297b31c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -33,7 +33,7 @@ public abstract class MixinWorldRenderer private int lastUpdatePosZ; @Inject(method = "tickRainSplashing", at = @At("HEAD"), cancellable = true) // renderRain - private void cancelRainRender(Camera camera, CallbackInfo ci) + private void tweakeroo$cancelRainRender(Camera camera, CallbackInfo ci) { if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) { @@ -42,7 +42,7 @@ private void cancelRainRender(Camera camera, CallbackInfo ci) } @Inject(method = "renderWeather", at = @At("HEAD"), cancellable = true) - private void cancelRainRender(LightmapTextureManager lightmap, float partialTicks, double x, double y, double z, CallbackInfo ci) + private void tweakeroo$cancelRainRender(LightmapTextureManager lightmap, float partialTicks, double x, double y, double z, CallbackInfo ci) { if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) { @@ -52,7 +52,7 @@ private void cancelRainRender(LightmapTextureManager lightmap, float partialTick @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void tweakeroo$preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -62,7 +62,7 @@ private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBloc @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void tweakeroo$postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } @@ -70,7 +70,7 @@ private void postSetupTerrain(float tickDelta, long limitTime, boolean renderBlo // Allow rendering the client player entity by spoofing one of the entity rendering conditions while in Free Camera mode @Redirect(method = "render", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;getFocusedEntity()Lnet/minecraft/entity/Entity;", ordinal = 3)) - private Entity allowRenderingClientPlayerInFreeCameraMode(Camera camera) + private Entity tweakeroo$allowRenderingClientPlayerInFreeCameraMode(Camera camera) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -85,7 +85,7 @@ private Entity allowRenderingClientPlayerInFreeCameraMode(Camera camera) @Inject(method = "setupTerrain", require = 0, at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/render/WorldRenderer;lastCameraX:D")) - private void rebuildChunksAroundCamera1( + private void tweakeroo$rebuildChunksAroundCamera1( Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) @@ -101,7 +101,7 @@ private void rebuildChunksAroundCamera1( @Inject(method = "setupTerrain", require = 0, at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/client/render/BuiltChunkStorage;updateCameraPosition(DD)V")) - private void rebuildChunksAroundCamera2( + private void tweakeroo$rebuildChunksAroundCamera2( Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator, CallbackInfo ci) { // Mark the chunks at the edge of the free camera's render range for rebuilding @@ -114,6 +114,7 @@ private void rebuildChunksAroundCamera2( int x = MathHelper.floor(camera.getPos().x) >> 4; int z = MathHelper.floor(camera.getPos().z) >> 4; CameraUtils.markChunksForRebuild(x, z, this.lastUpdatePosX, this.lastUpdatePosZ); + // TODO should send this to ServUX } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 6137f487d..462c80d11 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -94,7 +94,7 @@ public static void renderHotbarSwapOverlay(MinecraftClient mc, DrawContext drawC { ItemStack stack = player.getInventory().getStack(row * 9 + column); - if (!stack.isEmpty()) + if (stack.isEmpty() == false) { fi.dy.masa.malilib.render.InventoryOverlay.renderStackAt(stack, x, y, 1, mc, drawContext); } @@ -119,7 +119,6 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo { // We need to get the player from the server world (if available, ie. in single player), // so that the player itself won't be included in the ray trace - assert mc.player != null; Entity serverPlayer = world.getPlayerByUuid(mc.player.getUuid()); if (serverPlayer != null) @@ -170,7 +169,7 @@ else if (entity instanceof VillagerEntity) } else if (entity instanceof AbstractHorseEntity) { - inv = ((IMixinAbstractHorseEntity) entity).tweakeroo_getHorseInventory(); + inv = ((IMixinAbstractHorseEntity) entity).tweakeroo$getHorseInventory(); } } @@ -238,13 +237,11 @@ public static void renderPlayerInventoryOverlay(MinecraftClient mc, DrawContext fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f); fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, x, y, 9, 27, mc); - assert mc.player != null; fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, mc.player.getInventory(), x + slotOffsetX, y + slotOffsetY, 9, 9, 27, mc, drawContext); } public static void renderHotbarScrollOverlay(MinecraftClient mc, DrawContext drawContext) { - assert mc.player != null; Inventory inv = mc.player.getInventory(); final int xCenter = GuiUtils.getScaledWindowWidth() / 2; final int yCenter = GuiUtils.getScaledWindowHeight() / 2; @@ -305,8 +302,6 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) float pitch = camera.getPitch(); float yaw = camera.getYaw(); - //Quaternionf rot = new Quaternionf().rotationXYZ(-pitch * (float) (Math.PI / 180.0), yaw * (float) (Math.PI / 180.0), 0.0F); - matrix4fStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); // Fix rotation values using matrix4fRotateFix() matrix4fStack.rotateX(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(-pitch)); @@ -427,7 +422,6 @@ public static void renderPitchLockIndicator(MinecraftClient mc, DrawContext draw int height = 50; int x = xCenter - width / 2; int y = yCenter - height - 10; - assert mc.player != null; double currentPitch = mc.player.getPitch(); double centerPitch = 0; double indicatorRange = 180; @@ -484,7 +478,7 @@ private static void renderPitchIndicator(int x, int y, int width, int height, fi.dy.masa.malilib.render.RenderUtils.drawRect(x, yCenter + snapThreshOffset, width, 2, 0xFF20FF20); } } - else if (!isSnapRange) + else if (isSnapRange == false) { fi.dy.masa.malilib.render.RenderUtils.drawRect(x + 1, yCenter - 1, width - 2, 2, 0xFFC0C0C0); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index ca1784a4a..796e12c7c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -199,7 +199,7 @@ private static void doPotionWarnings(PlayerEntity player) Collection effects = player.getStatusEffects(); - if (!effects.isEmpty()) + if (effects.isEmpty() == false) { int minDuration = -1; int count = 0; @@ -228,7 +228,7 @@ private static void doPotionWarnings(PlayerEntity player) public static boolean isEntityAllowedByAttackingRestriction(EntityType type) { - if (!MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type)) + if (MiscTweaks.ENTITY_TYPE_ATTACK_RESTRICTION.isAllowed(type) == false) { MessageOutputType messageOutputType = (MessageOutputType) Configs.Generic.ENTITY_TYPE_ATTACK_RESTRICTION_WARN.getOptionListValue(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java index 8c6a4d129..e39a53910 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java @@ -43,7 +43,7 @@ else if (decodedFacingIndex >= 0 && decodedFacingIndex <= 5) { facing = Direction.byId(decodedFacingIndex); - if (!property.getValues().contains(facing)) + if (property.getValues().contains(facing) == false) { facing = context.getEntity().getHorizontalFacing().getOpposite(); } @@ -58,7 +58,7 @@ else if (decodedFacingIndex >= 0 && decodedFacingIndex <= 5) BlockPos headPos = context.pos.offset(facing); ItemPlacementContext ctx = context.getItemPlacementContext(); - if (!context.getWorld().getBlockState(headPos).canReplace(ctx)) + if (context.getWorld().getBlockState(headPos).canReplace(ctx) == false) { return null; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index a3684df24..47228106b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -101,20 +101,20 @@ public static void onTick(MinecraftClient mc) stackBeforeUse[1] = ItemStack.EMPTY; } - if (!use) + if (use == false) { clearClickedBlockInfoUse(); // Clear the cached stack when releasing both keys, so that the restock doesn't happen when // using another item or an empty hand. - if (!attack) + if (attack == false) { stackBeforeUse[0] = ItemStack.EMPTY; stackBeforeUse[1] = ItemStack.EMPTY; } } - if (!attack) + if (attack == false) { clearClickedBlockInfoAttack(); } @@ -127,18 +127,18 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - !stackOriginal.isEmpty() && + stackOriginal.isEmpty() == false && canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { - if (!isEmulatedClick) + if (isEmulatedClick == false) { //Tweakeroo.debugLog("onProcessRightClickPre storing stack: {}", stackOriginal); cacheStackInHand(hand); } // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on - boolean allowHotbar = !FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() && - !FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue(); + boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.preRestockHand(player, hand, allowHotbar); } @@ -164,7 +164,6 @@ public static void onLeftClickMousePre() sideFirstBreaking = ((BlockHitResult) trace).getSide(); } - assert mc.player != null; onProcessRightClickPre(mc.player, Hand.MAIN_HAND); } @@ -176,11 +175,10 @@ public static void onLeftClickMousePost() public static void cacheStackInHand(Hand hand) { PlayerEntity player = MinecraftClient.getInstance().player; - assert player != null; ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - !stackOriginal.isEmpty() && + stackOriginal.isEmpty() == false && canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { stackBeforeUse[hand.ordinal()] = stackOriginal.copy(); @@ -192,9 +190,8 @@ private static void onAttackTick(MinecraftClient mc) { if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { - assert mc.player != null; if (mc.player.getAbilities().creativeMode || - (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || !(mc.player.getMainHandStack().getItem() instanceof MiningToolItem))) + (Configs.Generic.FAST_LEFT_CLICK_ALLOW_TOOLS.getBooleanValue() || (mc.player.getMainHandStack().getItem() instanceof MiningToolItem) == false)) { final int count = Configs.Generic.FAST_LEFT_CLICK_COUNT.getIntegerValue(); @@ -255,7 +252,7 @@ private static void onUsingTick() //Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, side {} pos {} hitResult {}, posNew {}, posLast {}", side, pos, hitResult, posNew, posLast); if (hand != null && - !posNew.equals(posLast) && + posNew.equals(posLast) == false && canPlaceBlockIntoPosition(world, posNew, ctx) && isPositionAllowedByPlacementRestriction(posNew, side) && canPlaceBlockAgainst(world, pos, player, hand) @@ -364,7 +361,7 @@ public static ActionResult onProcessRightClickBlock( stateClickedOn = state; } - if (!canPlaceBlockAgainst(world, posIn, player, hand)) + if (canPlaceBlockAgainst(world, posIn, player, hand) == false) { return ActionResult.PASS; } @@ -463,7 +460,7 @@ private static ActionResult tryPlaceBlock( boolean simpleOffset = false; - if (!handleFlexible && + if (handleFlexible == false && FeatureToggle.TWEAK_FAKE_SNEAK_PLACEMENT.getBooleanValue() && stack.getItem() instanceof BlockItem) { @@ -485,7 +482,7 @@ private static ActionResult tryPlaceBlock( if (posNew == null) { - if (!flexible || !isFirstClick) + if (flexible == false || isFirstClick == false) { posNew = posIn; } @@ -505,13 +502,13 @@ private static ActionResult tryPlaceBlock( // Pistons, Droppers, Dispensers should face into the block, but Observers should point their back/output // side into the block when the Accurate Placement In hotkey is used - if (!(stack.getItem() instanceof BlockItem) || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) + if ((stack.getItem() instanceof BlockItem) == false || ((BlockItem) stack.getItem()).getBlock() != Blocks.OBSERVER) { facing = facing.getOpposite(); } //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: {}", facing); } - else if (!flexible || !rotation) + else if (flexible == false || rotation == false) { if (stack.getItem() instanceof BlockItem) { @@ -603,7 +600,7 @@ else if (!flexible || !rotation) } } - if (!isFirstClick && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) + if (isFirstClick == false && Configs.Generic.FAST_PLACEMENT_REMEMBER_ALWAYS.getBooleanValue()) { return handleFlexibleBlockPlacement(controller, player, world, posIn, sideIn, playerYaw, hitVec, hand, null); } @@ -617,11 +614,11 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt { BlockState state = world.getBlockState(pos); - if (!stackClickedOn.isEmpty()) + if (stackClickedOn.isEmpty() == false) { ItemStack stack = state.getBlock().getPickStack(world, pos, state); - if (!fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack)) + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClickedOn, stack) == false) { return false; } @@ -641,7 +638,7 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt ItemStack stackClicked = state.getBlock().getPickStack(world, pos, state); ItemStack stackHand = player.getStackInHand(hand); - if (!fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand)) + if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) { return false; } @@ -669,7 +666,7 @@ public static boolean canUseItemWithRestriction(ItemRestriction restriction, Pla private static boolean canUseFastRightClick(PlayerEntity player) { - if (!canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player)) + if (canUseItemWithRestriction(FAST_RIGHT_CLICK_ITEM_RESTRICTION, player) == false) { return false; } @@ -693,12 +690,12 @@ public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stac { ItemStack stackCurrent = player.getStackInHand(hand); - if (!stackOriginal.isEmpty() && player.getInventory().selectedSlot == hotbarSlot && - (stackCurrent.isEmpty() || !ItemStack.areItemsEqual(stackCurrent, stackOriginal))) + if (stackOriginal.isEmpty() == false && player.getInventory().selectedSlot == hotbarSlot && + (stackCurrent.isEmpty() || ItemStack.areItemsEqual(stackCurrent, stackOriginal) == false)) { // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on - boolean allowHotbar = !FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() && - !FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue(); + boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && + FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; InventoryUtils.restockNewStackToHand(player, hand, stackOriginal, allowHotbar); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java b/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java index 9b6556766..1f92f26a8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CameraEntity.java @@ -41,7 +41,7 @@ public static void movementTick() { CameraEntity camera = getCamera(); - if (camera != null && !Configs.Generic.FREE_CAMERA_PLAYER_MOVEMENT.getBooleanValue()) + if (camera != null && Configs.Generic.FREE_CAMERA_PLAYER_MOVEMENT.getBooleanValue() == false) { GameOptions options = MinecraftClient.getInstance().options; @@ -51,7 +51,7 @@ public static void movementTick() { sprinting = true; } - else if (!options.forwardKey.isPressed() && !options.backKey.isPressed()) + else if (options.forwardKey.isPressed() == false && options.backKey.isPressed() == false) { sprinting = false; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index fc49ef7a4..7e8871d88 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -66,9 +66,9 @@ private static void setCreativeExtraItems(ItemGroup group, List items) { ItemStack stack = InventoryUtils.getItemStackFromString(str); - if (!stack.isEmpty()) + if (stack.isEmpty() == false) { - if (!stack.getComponents().isEmpty()) + if (stack.getComponents().isEmpty() == false) { ADDED_ITEMS.put(group, stack); } @@ -80,34 +80,6 @@ private static void setCreativeExtraItems(ItemGroup group, List items) } } - /* Removed in favor of a new InventoryUtils.getItemStackFromString via MaLiLib - - public static ItemStack parseItemFromString(String str) - { - try - { - // This took me like 2 hours to find this for code that is unused - ItemStringReader itemStringReader = new ItemStringReader(BuiltinRegistries.createWrapperLookup()); - ItemStringReader.ItemResult itemResult = itemStringReader.consume(new StringReader(str)); - Item item = itemResult.item().value(); - - if (item != null) - { - //ComponentMap components = item.getComponents(); - //stack.copyComponentsToNewStack(components); - - return new ItemStack(item); - } - } - catch (Exception e) - { - Tweakeroo.logger.warn("Invalid item '{}'", str); - } - - return ItemStack.EMPTY; - } - */ - public static void removeInfestedBlocks(DefaultedList stacks) { stacks.removeIf((stack) -> stack.getItem() instanceof BlockItem && diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 8cfa75ed3..d668cfa95 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -879,7 +879,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) { inventory.selectedSlot = slotNumber - 36; //Tweakeroo.debugLog("swapToolToHand() slotnumber: {}, inv.selected slot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); - Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); + mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else { @@ -892,7 +892,7 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) { inventory.selectedSlot = hotbarSlot; //Tweakeroo.debugLog("swapToolToHand() hotbarSlot: {} (vs selectedSlot {}), inv.selected slot: {} --> Yeet packet", hotbarSlot, selectedSlot, inventory.selectedSlot); - Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); + mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } //Tweakeroo.debugLog("swapToolToHand(): clickSlot --> slotNumber {}, hotbarSlot {}", slotNumber, hotbarSlot); @@ -1062,7 +1062,7 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest - if (!player.getInventory().getMainHandStack().isEmpty()) + if (player.getInventory().getMainHandStack().isEmpty() == false) { //Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 2 --> slot1.id {} (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); @@ -1075,7 +1075,7 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s } } - if (!slot1.hasStack()) + if (slot1.hasStack() == false) { break; } @@ -1121,8 +1121,8 @@ public static void switchToPickedBlock() BlockState stateTargeted = world.getBlockState(pos); ItemStack stack = stateTargeted.getBlock().getPickStack(world, pos, stateTargeted); - if (!stack.isEmpty() && - !fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack())) + if (stack.isEmpty() == false && + fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stack, player.getMainHandStack()) == false) { ScreenHandler container = player.currentScreenHandler; PlayerInventory inventory = player.getInventory(); @@ -1142,7 +1142,6 @@ public static void switchToPickedBlock() { inventory.addPickBlock(stack); //Tweakeroo.debugLog("switchToPickedBlock(): clickCreativeStack --> inv.selectedSlot {}", inventory.selectedSlot); - assert mc.interactionManager != null; mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); } else @@ -1186,28 +1185,4 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) return changed; } - /* - if (nbt.contains("BlockEntityTag", Constants.NBT.TAG_COMPOUND)) - { - NbtCompound tag = nbt.getCompound("BlockEntityTag"); - - if (tag.contains("Items", Constants.NBT.TAG_LIST) && - tag.getList("Items", Constants.NBT.TAG_COMPOUND).isEmpty()) - { - tag.remove("Items"); - changed = true; - } - - if (tag.isEmpty()) - { - nbt.remove("BlockEntityTag"); - } - } - - if (nbt.isEmpty()) - { - stack.setNbt(null); - changed = true; - } - */ } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java index 0352fdc7a..8c31f6bee 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java @@ -205,23 +205,23 @@ public static void resetMouseSensitivityForZoom() public static boolean isStrippableLog(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); - return IMixinAxeItem.tweakeroo_getStrippedBlocks().containsKey(state.getBlock()); + return IMixinAxeItem.tweakeroo$getStrippedBlocks().containsKey(state.getBlock()); } public static boolean isShovelPathConvertableBlock(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); - return IMixinShovelItem.tweakeroo_getPathStates().containsKey(state.getBlock()); + return IMixinShovelItem.tweakeroo$getPathStates().containsKey(state.getBlock()); } public static boolean getUpdateExec(CommandBlockBlockEntity te) { - return ((IMixinCommandBlockExecutor) te.getCommandExecutor()).getUpdateLastExecution(); + return ((IMixinCommandBlockExecutor) te.getCommandExecutor()).tweakeroo$getUpdateLastExecution(); } public static void setUpdateExec(CommandBlockBlockEntity te, boolean value) { - ((IMixinCommandBlockExecutor) te.getCommandExecutor()).setUpdateLastExecution(value); + ((IMixinCommandBlockExecutor) te.getCommandExecutor()).tweakeroo$setUpdateLastExecution(value); } public static void printDeathCoordinates(MinecraftClient mc) @@ -473,7 +473,7 @@ public static boolean writeAllMapsAsImages() return true; } - Map data = ((IMixinClientWorld) mc.world).tweakeroo_getMapStates(); + Map data = ((IMixinClientWorld) mc.world).tweakeroo$getMapStates(); String worldName = StringUtils.getWorldOrServerName(); if (worldName == null) From 5511eebc6e41808fe7377e45568b0c5b1593d1c0 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 4 Apr 2024 17:39:18 -0400 Subject: [PATCH 052/128] 24w14a - some code cleanups --- .../dy/masa/tweakeroo/config/Callbacks.java | 3 +- .../fi/dy/masa/tweakeroo/config/Configs.java | 4 +-- .../masa/tweakeroo/config/FeatureToggle.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinEntity.java | 34 +++++++------------ .../masa/tweakeroo/mixin/MixinItemEntity.java | 4 +-- .../masa/tweakeroo/mixin/MixinItemGroup.java | 7 ++-- .../tweakeroo/mixin/MixinLivingEntity.java | 24 ++++++------- .../tweakeroo/mixin/MixinPlayerEntity.java | 2 -- .../tweakeroo/mixin/MixinSignBlockEntity.java | 7 ++-- .../mixin/MixinStructureBlockBlockEntity.java | 4 +-- .../tweakeroo/mixin/MixinWorldRenderer.java | 2 +- 11 files changed, 37 insertions(+), 56 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java index 381816477..0e3e5dad5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java @@ -182,10 +182,9 @@ public void onValueChanged(IConfigBoolean config) private void applyValue(double gamma) { - Tweakeroo.debugLog("Callbacks#applyValue(): pre"); @SuppressWarnings("unchecked") IMixinSimpleOption opt = (IMixinSimpleOption) (Object) this.mc.options.getGamma(); - Tweakeroo.debugLog("Callbacks#applyValue(): post"); + // Not sure why IntelliJ greys this out while it works? opt.tweakeroo$setValueWithoutCheck(gamma); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index fe109d055..80f7f02f3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -220,7 +220,7 @@ public static class Lists public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList("blockTypeBreakRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Block Type Break Restriction tweak"); public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList("blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), "The blocks that are NOT allowed to be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to Black List"); public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList("blockTypeBreakRestrictionWhiteList", ImmutableList.of(), "The only blocks that can be broken while the Block Break Restriction tweak is enabled,\nif the blockBreakRestrictionListType is set to White List"); - public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); + //public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), "Extra items that should be appended to the creative inventory.\nCurrently these will appear in the Transportation category.\nIn the future the group per added item will be customizable."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Entity Type Attack Restriction tweak"); public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); @@ -248,7 +248,7 @@ public static class Lists BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST, BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST, - CREATIVE_EXTRA_ITEMS, + //CREATIVE_EXTRA_ITEMS, ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE, ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST, ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 4740a2d9e..bc5a9cdc6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -32,7 +32,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), + TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), // TODO/FIXME 1.19+ the mixin needs an access widener now //TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows adding custom flat world presets to the list.\nThe presets are defined in Lists -> flatWorldPresets"), TWEAK_CUSTOM_FLY_DECELERATION ("tweakCustomFlyDeceleration", false, "", "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index 5295eb452..0eadf5447 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -44,39 +44,31 @@ public abstract class MixinEntity @Inject(method = "updateVelocity", at = @At("HEAD"), cancellable = true) private void tweakeroo$moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec3d motion, CallbackInfo ci) { - Tweakeroo.debugLog("tweakeroo$moreAccurateMoveRelative(): pre"); - // TODO I'm not sure why IntelliJ is greying this out if the code is correct? --> TEST - if ((Object) this instanceof ClientPlayerEntity) + // I'm not sure why IntelliJ is greying this out if the code is correct. + if ((FeatureToggle.TWEAK_SNAP_AIM.getBooleanValue()) && ((Object) this instanceof ClientPlayerEntity)) { - Tweakeroo.debugLog("tweakeroo$moreAccurateMoveRelative(): post"); - if (FeatureToggle.TWEAK_SNAP_AIM.getBooleanValue()) - { - double speed = motion.lengthSquared(); - - if (speed >= 1.0E-7D) - { - motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); - double xFactor = Math.sin(this.yaw * Math.PI / 180D); - double zFactor = Math.cos(this.yaw * Math.PI / 180D); - net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); + double speed = motion.lengthSquared(); - this.setVelocity(this.getVelocity().add(change)); - } + if (speed >= 1.0E-7D) + { + motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); + double xFactor = Math.sin(this.yaw * Math.PI / 180D); + double zFactor = Math.cos(this.yaw * Math.PI / 180D); + net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); - ci.cancel(); + this.setVelocity(this.getVelocity().add(change)); } + + ci.cancel(); } } @Inject(method = "changeLookDirection", at = @At("HEAD"), cancellable = true) private void tweakeroo$overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) { - Tweakeroo.debugLog("tweakeroo$overrideYaw(): pre"); - // TODO I'm not sure why IntelliJ is greying this out if the code is correct? --> TEST + // I'm not sure why IntelliJ is greying this out if the code is correct? if ((Object) this instanceof ClientPlayerEntity) { - Tweakeroo.debugLog("tweakeroo$overrideYaw(): post"); - if (CameraUtils.shouldPreventPlayerMovement()) { CameraUtils.updateCameraRotations((float) yawChange, (float) pitchChange); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 8a16a0ade..743c5b981 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -78,12 +78,10 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) @Inject(method = "tryMerge(Lnet/minecraft/entity/ItemEntity;)V", at = @At("HEAD"), cancellable = true) private void tweakeroo$stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) { - Tweakeroo.debugLog("tweakeroo$stackEmptyShulkerBoxes(): pre"); - // TODO I don't know why IntelliJ greys this out. --> TEST + // I don't know why IntelliJ greys this out while it is working well if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { ItemEntity self = (ItemEntity) (Object) this; - Tweakeroo.debugLog("tweakeroo$stackEmptyShulkerBoxes(): post"); ItemStack stackSelf = self.getStack(); ItemStack stackOther = other.getStack(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java index 7769372ed..75426bfa5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java @@ -5,15 +5,16 @@ @Mixin(net.minecraft.item.ItemGroup.class) public abstract class MixinItemGroup { - /* // TODO 1.19.3+ + // TODO 1.19.3+ + /* @Inject(method = "appendStacks", at = @At("RETURN")) private void tweakeroo$appendCustomItems(net.minecraft.util.collection.DefaultedList stacks, CallbackInfo ci) { if (FeatureToggle.TWEAK_CREATIVE_EXTRA_ITEMS.getBooleanValue()) { - List extraStacks = CreativeExtraItems.getExtraStacksForGroup((net.minecraft.item.ItemGroup) (Object) this); + List extraStacks = CreativeExtraItems.getExtraStacksForGroup((net.minecraft.item.ItemGroup) (Object) this); stacks.addAll(extraStacks); } } - */ + */ } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index e2a5a7179..f536772b9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -39,18 +39,15 @@ private MixinLivingEntity(EntityType type, World worldIn) cancellable = true) private void tweakeroo$removeOwnPotionEffects(CallbackInfo ci) { + MinecraftClient mc = MinecraftClient.getInstance(); + if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue()) { - Tweakeroo.debugLog("tweakeroo$removeOwnPotionEffects(): pre"); - - // TODO I don't know why IntelliJ is greying this out. --> TEST - if (((Object) this) instanceof ClientPlayerEntity) + // I don't know why IntelliJ is greying this out when it works fine. + if ((((Object) this) == (LivingEntity) mc.player) && + (mc.options.getPerspective() == Perspective.FIRST_PERSON)) { - Tweakeroo.debugLog("tweakeroo$removeOwnPotionEffects(): post"); - if (MinecraftClient.getInstance().options.getPerspective() == Perspective.FIRST_PERSON) - { - ci.cancel(); - } + ci.cancel(); } } } @@ -59,14 +56,13 @@ private MixinLivingEntity(EntityType type, World worldIn) target = "Lnet/minecraft/entity/LivingEntity;tickFallFlying()V")) private void tweakeroo$applyCustomDeceleration(CallbackInfo ci) { + MinecraftClient mc = MinecraftClient.getInstance(); + if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue()) { - Tweakeroo.debugLog("tweakeroo$applyCustomDeceleration(): pre"); - - // TODO I don't know why IntelliJ is greying this out. --> TEST - if (((Object) this) instanceof ClientPlayerEntity) + // I don't know why IntelliJ is greying this out when it works fine. + if (((Object) this) == (LivingEntity) mc.player) { - Tweakeroo.debugLog("tweakeroo$applyCustomDeceleration(): post"); MiscUtils.handlePlayerDeceleration(); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index cafc439d4..4eb8f814a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -67,7 +67,6 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); - // TODO this should be synchronized via ServUX } } } @@ -89,7 +88,6 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); - // TODO this should be synchronized via ServUX } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index ffaa0438a..a313c51c3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -1,6 +1,7 @@ package fi.dy.masa.tweakeroo.mixin; import fi.dy.masa.tweakeroo.Tweakeroo; +import net.minecraft.client.gui.screen.ingame.HangingSignEditScreen; import net.minecraft.registry.RegistryWrapper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -42,13 +43,11 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP { MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.currentScreen instanceof SignEditScreen) + if (mc.currentScreen instanceof SignEditScreen || mc.currentScreen instanceof HangingSignEditScreen) { - Tweakeroo.debugLog("tweakeroo$restoreCopiedText(): pre"); - // TODO I do not know why IntelliJ is greying this out. --> TEST + // I do not know why IntelliJ is greying this out when it works fine. if (((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) { - Tweakeroo.debugLog("tweakeroo$restoreCopiedText(): post"); MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java index f1ad8a75f..c61b39c98 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java @@ -53,14 +53,12 @@ private MixinStructureBlockBlockEntity(BlockEntityType blockEntityType, Block @Inject(method = "streamCornerPos", at = @At("HEAD"), cancellable = true) private void tweakeroo$overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoReturnable> cir) { - Tweakeroo.debugLog("tweakeroo$overrideCornerBlockScan(): pre"); - // TODO I do not know why IntelliJ is greying this out. --> TEST + // I do not know why IntelliJ is greying this out, it appears to function as expected. if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { BlockPos pos = this.getPos(); World world = this.getWorld(); String name = ((StructureBlockBlockEntity) (Object) this).getTemplateName(); - Tweakeroo.debugLog("tweakeroo$overrideCornerBlockScan(): post"); int maxSize = Configs.Generic.STRUCTURE_BLOCK_MAX_SIZE.getIntegerValue(); int maxOffset = 48; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index 01297b31c..eac568187 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -114,7 +114,7 @@ public abstract class MixinWorldRenderer int x = MathHelper.floor(camera.getPos().x) >> 4; int z = MathHelper.floor(camera.getPos().z) >> 4; CameraUtils.markChunksForRebuild(x, z, this.lastUpdatePosX, this.lastUpdatePosZ); - // TODO should send this to ServUX + // TODO could send this to ServUX } } } From 5713d0a54c4f2d8591e187543395bff48b874b0c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:37:35 -0400 Subject: [PATCH 053/128] 24w14a - Lava visibility math corrections --- .../mixin/MixinBackgroundRenderer.java | 32 ------------------- .../masa/tweakeroo/renderer/RenderUtils.java | 18 +++++++++-- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 58f0cb66d..02e26a697 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -62,38 +62,6 @@ public abstract class MixinBackgroundRenderer return original; } - /* - @ModifyVariable( - method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", - slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), - at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 2), ordinal = 1) - private static float overrideFogStart(float original) - { - if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) - { - return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 1.6f; - } - - return original; - } - - @ModifyVariable( - method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", - slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), - at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 3), ordinal = 2) - private static float overrideFogEnd(float original) - { - if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) - { - return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 2.0f; - } - - return original; - } - */ - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld$Properties;getHorizonShadingRatio()F")) diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 462c80d11..102aca050 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -271,16 +271,28 @@ public static float getLavaFogDistance(Entity entity, float originalFog) final int aqua = EnchantmentHelper.getEquipmentLevel(Enchantments.AQUA_AFFINITY, living); float fog = originalFog; + // With the new Vanilla changes, the old values were Overpowered. + // (was: 1.6f, and resp * 1.6f) -- getting values as high as 38.4f, + // when we really only need around 15.0f at the most for full visibility. + + // Max +6.2f (Additive) --> these values feel about right + // 5.0f for Fire Res (Max: 12.7f) + // 1.0f no Fire Res (Max: 7.2f) + + if (originalFog > 3.0f) + { + fog += 1.5f; // Fire Res bonus +1.5f + } if (aqua > 0) { - fog *= 1.6f; + fog += 1.7f; } - if (resp > 0) { - fog *= (float) resp * 1.6f; + fog += (float) resp * 1.5f; } + //Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {} originalFog: {}", aqua, resp, fog, originalFog); return Math.max(fog, originalFog); } From 42f4bd1f88a6e87313e063ac8d41bf89750862fc Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Mon, 8 Apr 2024 09:20:24 -0400 Subject: [PATCH 054/128] 24w14a - gradle 8.7, yarn build 6 --- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +++- gradlew.bat | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3489ec821..778ddeae0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w14a minecraft_version = 24w14a -mappings_version = 24w14a+build.3 +mappings_version = 24w14a+build.6 fabric_loader_version = 0.15.9 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17655d0ef..b82aa23a4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f1..25da30dbd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail From 4a246670ced8e9f6586675cfe7b7db4a9ae14e03 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 10 Apr 2024 15:28:09 -0400 Subject: [PATCH 055/128] 1.20.5-pre1 support -- rename mod_version to 0.20.0-beta.1 --- gradle.properties | 12 ++++++------ .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 778ddeae0..0c1d1954a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-snap +mod_version = 0.20.0-beta.1 # Required malilib version -malilib_version = 0.19.0-snap +malilib_version = 0.19.0-beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w14a -minecraft_version = 24w14a -mappings_version = 24w14a+build.6 +minecraft_version_out = 1.20.5-pre1 +minecraft_version = 1.20.5-pre1 +mappings_version = 1.20.5-pre1+build.3 fabric_loader_version = 0.15.9 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 -fabric_api_version = 0.96.14+1.20.5 +fabric_api_version = 0.96.15+1.20.5 diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d668cfa95..5bf9cb7ad 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1169,7 +1169,7 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) if (itemContainer != null) { - Iterator iter = itemContainer.iterator(); + Iterator iter = itemContainer.stream().iterator(); while (iter.hasNext()) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index badd58fb0..e664c6699 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "depends": { "minecraft": ">=1.20.4", - "malilib": ">=0.19.0-snap" + "malilib": ">=0.19.0-beta.1" }, "custom": { "modmenu": { From 3184157a85dc35bb1db433756c52ae898cb1632d Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 11 Apr 2024 01:38:14 -0400 Subject: [PATCH 056/128] 1.20.5-pre.1 - yarn build 4 --- gradle.properties | 2 +- src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java | 6 ++++-- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0c1d1954a..3ad0f16d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-beta.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5-pre1 minecraft_version = 1.20.5-pre1 -mappings_version = 1.20.5-pre1+build.3 +mappings_version = 1.20.5-pre1+build.4 fabric_loader_version = 0.15.9 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index 35e6750b0..8d4ab8688 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -1,18 +1,20 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.item.Item; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import fi.dy.masa.tweakeroo.util.IItemStackLimit; +import org.spongepowered.asm.mixin.Unique; @Mixin(net.minecraft.item.Item.class) public abstract class MixinItem implements IItemStackLimit { - @Shadow public int getMaxCount() { return 0; } + @Shadow public abstract Item asItem(); @Override public int tweakeroo$getMaxStackSize(net.minecraft.item.ItemStack stack) { - return this.getMaxCount(); + return this.asItem().getMaxCount(); } /* // TODO 1.19.3+ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e664c6699..57759c3c9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.20.4", + "minecraft": ">=1.20.5-beta.1", "malilib": ">=0.19.0-beta.1" }, "custom": { From 690812271f01f9b6a299ee63ab61c8bc7d6bbc70 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 11 Apr 2024 01:38:42 -0400 Subject: [PATCH 057/128] 1.20.5-pre.1 - yarn build 4 --- src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index 8d4ab8688..c41fe03e4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -4,7 +4,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import fi.dy.masa.tweakeroo.util.IItemStackLimit; -import org.spongepowered.asm.mixin.Unique; @Mixin(net.minecraft.item.Item.class) public abstract class MixinItem implements IItemStackLimit From 39699dd47880052d23b7a0533b506c513149ba37 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 11 Apr 2024 02:21:09 -0400 Subject: [PATCH 058/128] merge from UPSTREAM: [QOL] Rehash Angel Block tweak using "floatato technology" (maruohon#496) --- .../fi/dy/masa/tweakeroo/config/Configs.java | 4 +- .../dy/masa/tweakeroo/event/InputHandler.java | 40 ++++++++----------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 80f7f02f3..014a6962b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -37,6 +37,7 @@ public class Configs implements IConfigHandler public static class Generic { public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); + public static final ConfigDouble ANGEL_BLOCK_PLACEMENT_DISTANCE = new ConfigDouble ("angelBlockPlacementDistance", 3, 1, 5, "The distance from the player blocks can be placed in\nthe air when tweakAngelBlock is enabled.\n5 is the maximum the server allows."); public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); @@ -50,7 +51,7 @@ public static class Generic public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); @@ -157,6 +158,7 @@ public static class Generic AFTER_CLICKER_CLICK_COUNT, BLOCK_REACH_DISTANCE, + ANGEL_BLOCK_PLACEMENT_DISTANCE, BREAKING_GRID_SIZE, BUNDLE_DISPLAY_BACKGROUND_COLOR, BUNDLE_PREVIEW_REQUIRE_SHIFT, diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java index cf2f31d5d..99bc4d2c0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java @@ -9,8 +9,6 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import fi.dy.masa.malilib.config.options.ConfigDouble; import fi.dy.masa.malilib.gui.GuiBase; @@ -22,13 +20,13 @@ import fi.dy.masa.malilib.hotkeys.KeyCallbackAdjustable; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; -import fi.dy.masa.malilib.util.PositionUtils; import fi.dy.masa.tweakeroo.Reference; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.config.Hotkeys; import fi.dy.masa.tweakeroo.util.MiscUtils; import fi.dy.masa.tweakeroo.util.SnapAimMode; +import net.minecraft.world.RaycastContext; public class InputHandler implements IKeybindProvider, IKeyboardInputHandler, IMouseInputHandler { @@ -94,31 +92,27 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve { MinecraftClient mc = MinecraftClient.getInstance(); - if (GuiUtils.getCurrentScreen() == null && mc.player != null && mc.player.isCreative() && - eventButtonState && mc.options.useKey.matchesMouse(eventButton) && - FeatureToggle.TWEAK_ANGEL_BLOCK.getBooleanValue() && - mc.crosshairTarget != null && mc.crosshairTarget.getType() == HitResult.Type.MISS) + if (mc.world == null || mc.player == null || mc.interactionManager == null || mc.crosshairTarget == null || + GuiUtils.getCurrentScreen() != null) { - BlockPos posFront = PositionUtils.getPositionInfrontOfEntity(mc.player); - - if (mc.world.isAir(posFront)) - { - Direction facing = PositionUtils.getClosestLookingDirection(mc.player).getOpposite(); - Vec3d hitVec = PositionUtils.getHitVecCenter(posFront, facing); - BlockHitResult context = new BlockHitResult(hitVec, facing, posFront, false); - ItemStack stack = mc.player.getMainHandStack(); - - if (stack.isEmpty() == false && stack.getItem() instanceof BlockItem) - { - mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, context); - return true; - } + return false; + } - stack = mc.player.getOffHandStack(); + if (mc.player.isCreative() && FeatureToggle.TWEAK_ANGEL_BLOCK.getBooleanValue() && eventButtonState && + mc.options.useKey.matchesMouse(eventButton) && mc.crosshairTarget.getType() == HitResult.Type.MISS) + { + Vec3d eyePos = mc.player.getEyePos(); + Vec3d rotVec = mc.player.getRotationVec(1.0f); + Vec3d vec3d = eyePos.add(rotVec.multiply(Configs.Generic.ANGEL_BLOCK_PLACEMENT_DISTANCE.getDoubleValue())); + BlockHitResult context = mc.world.raycast(new RaycastContext(eyePos, vec3d, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.SOURCE_ONLY, mc.player)); + for (Hand hand : Hand.values()) + { + ItemStack stack = mc.player.getStackInHand(hand); if (stack.isEmpty() == false && stack.getItem() instanceof BlockItem) { - mc.interactionManager.interactBlock(mc.player, Hand.OFF_HAND, context); + mc.interactionManager.interactBlock(mc.player, hand, context); + mc.player.swingHand(hand); return true; } } From 11b3813b143d91dd173593fa26d045e6e2fca487 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 11 Apr 2024 02:38:51 -0400 Subject: [PATCH 059/128] some import cleanups --- src/main/java/fi/dy/masa/tweakeroo/InitHandler.java | 2 +- src/main/java/fi/dy/masa/tweakeroo/Reference.java | 2 +- src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java | 4 ++-- .../java/fi/dy/masa/tweakeroo/event/InputHandler.java | 9 ++------- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java index a59b70594..0d902bfdc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo; -import fi.dy.masa.malilib.interfaces.IWorldLoadListener; import net.minecraft.client.MinecraftClient; import fi.dy.masa.malilib.config.ConfigManager; import fi.dy.masa.malilib.event.InputEventHandler; @@ -9,6 +8,7 @@ import fi.dy.masa.malilib.event.WorldLoadHandler; import fi.dy.masa.malilib.interfaces.IInitializationHandler; import fi.dy.masa.malilib.interfaces.IRenderer; +import fi.dy.masa.malilib.interfaces.IWorldLoadListener; import fi.dy.masa.tweakeroo.config.Callbacks; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.event.ClientTickHandler; diff --git a/src/main/java/fi/dy/masa/tweakeroo/Reference.java b/src/main/java/fi/dy/masa/tweakeroo/Reference.java index e641d5205..4e46a356e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Reference.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Reference.java @@ -1,7 +1,7 @@ package fi.dy.masa.tweakeroo; -import fi.dy.masa.malilib.util.StringUtils; import net.minecraft.MinecraftVersion; +import fi.dy.masa.malilib.util.StringUtils; public class Reference { diff --git a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java index dfc409a21..bc8616c77 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java @@ -1,10 +1,10 @@ package fi.dy.masa.tweakeroo; -import fi.dy.masa.tweakeroo.config.Configs; +import net.fabricmc.api.ModInitializer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import fi.dy.masa.malilib.event.InitializationHandler; -import net.fabricmc.api.ModInitializer; +import fi.dy.masa.tweakeroo.config.Configs; public class Tweakeroo implements ModInitializer { diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java index 99bc4d2c0..480775040 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java @@ -10,14 +10,10 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.RaycastContext; import fi.dy.masa.malilib.config.options.ConfigDouble; import fi.dy.masa.malilib.gui.GuiBase; -import fi.dy.masa.malilib.hotkeys.IHotkey; -import fi.dy.masa.malilib.hotkeys.IKeybindManager; -import fi.dy.masa.malilib.hotkeys.IKeybindProvider; -import fi.dy.masa.malilib.hotkeys.IKeyboardInputHandler; -import fi.dy.masa.malilib.hotkeys.IMouseInputHandler; -import fi.dy.masa.malilib.hotkeys.KeyCallbackAdjustable; +import fi.dy.masa.malilib.hotkeys.*; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; import fi.dy.masa.tweakeroo.Reference; @@ -26,7 +22,6 @@ import fi.dy.masa.tweakeroo.config.Hotkeys; import fi.dy.masa.tweakeroo.util.MiscUtils; import fi.dy.masa.tweakeroo.util.SnapAimMode; -import net.minecraft.world.RaycastContext; public class InputHandler implements IKeybindProvider, IKeyboardInputHandler, IMouseInputHandler { From 8f81bf38ec2593dd08570ab963f3b778cc59583a Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 12 Apr 2024 01:15:55 -0400 Subject: [PATCH 060/128] 1.20.5-pre1-- code cleanups --- gradle.properties | 2 +- src/main/java/fi/dy/masa/tweakeroo/config/Configs.java | 4 ---- .../java/fi/dy/masa/tweakeroo/config/FeatureToggle.java | 1 - .../java/fi/dy/masa/tweakeroo/event/RenderHandler.java | 9 --------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3ad0f16d5..9be1420dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-beta.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5-pre1 minecraft_version = 1.20.5-pre1 -mappings_version = 1.20.5-pre1+build.4 +mappings_version = 1.20.5-pre1+build.5 fabric_loader_version = 0.15.9 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 014a6962b..a0918ecee 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -42,8 +42,6 @@ public static class Generic public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); - public static final ConfigColor BUNDLE_DISPLAY_BACKGROUND_COLOR = new ConfigColor ("bundleDisplayBgColor", "#41854F4C", "Enables tinting/coloring the Bundle display"); - public static final ConfigBoolean BUNDLE_PREVIEW_REQUIRE_SHIFT = new ConfigBoolean ("bundlePreviewRequireShift", true, "Whether holding shift is required for the Bundle Preview"); public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled"); public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers."); public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); @@ -160,8 +158,6 @@ public static class Generic BLOCK_REACH_DISTANCE, ANGEL_BLOCK_PLACEMENT_DISTANCE, BREAKING_GRID_SIZE, - BUNDLE_DISPLAY_BACKGROUND_COLOR, - BUNDLE_PREVIEW_REQUIRE_SHIFT, CUSTOM_INVENTORY_GUI_SCALE, ENTITY_REACH_DISTANCE, FAST_BLOCK_PLACEMENT_COUNT, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index bc5a9cdc6..504c1a9b0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -26,7 +26,6 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable 'chatBackgroundColor'"), TWEAK_CHAT_PERSISTENT_TEXT ("tweakChatPersistentText", false, "", "Stores the text from the chat input text field\nand restores it when the chat is opened again"), TWEAK_CHAT_TIMESTAMP ("tweakChatTimestamp", false, "", "Adds timestamps to chat messages"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 83bf29f39..fc5d8659b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.BundleItem; import net.minecraft.item.Item; import org.joml.Matrix4f; @@ -82,14 +81,6 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } } - else if (item instanceof BundleItem) - { - if (FeatureToggle.TWEAK_BUNDLE_PREVIEW.getBooleanValue() && - (!Configs.Generic.BUNDLE_PREVIEW_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown())) - { - fi.dy.masa.malilib.render.RenderUtils.renderBundlePreview(stack, x, y, Configs.Generic.BUNDLE_DISPLAY_BACKGROUND_COLOR.getColor(), drawContext); - } - } else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && item.toString().contains("shulker")) { if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) From 9d28184ef1d9927803a595244d5c1b113742cca8 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 14 Apr 2024 00:58:39 -0400 Subject: [PATCH 061/128] 1.20.5-pre.1 - code cleanups --- gradle/wrapper/gradle-wrapper.properties | 2 - .../java/fi/dy/masa/tweakeroo/Reference.java | 4 -- .../dy/masa/tweakeroo/config/Callbacks.java | 9 ++- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 - .../masa/tweakeroo/config/FeatureToggle.java | 2 +- .../masa/tweakeroo/event/RenderHandler.java | 2 +- .../tweakeroo/event/WorldLoadListener.java | 7 +- .../tweakeroo/mixin/IMixinAbstractBlock.java | 2 +- .../mixin/IMixinAbstractHorseEntity.java | 2 +- .../masa/tweakeroo/mixin/IMixinAxeItem.java | 2 +- .../mixin/IMixinChunkLightProvider.java | 2 +- .../tweakeroo/mixin/IMixinClientWorld.java | 2 +- .../mixin/IMixinCommandBlockExecutor.java | 4 +- .../tweakeroo/mixin/IMixinShovelItem.java | 2 +- .../tweakeroo/mixin/IMixinSimpleOption.java | 2 +- .../MixinAbstractClientPlayerEntity.java | 2 +- .../mixin/MixinAbstractInventoryScreen.java | 2 +- .../mixin/MixinAbstractSignEditScreen.java | 8 +-- .../mixin/MixinBackgroundRenderer.java | 21 ++---- .../masa/tweakeroo/mixin/MixinBatEntity.java | 2 +- .../mixin/MixinBeaconBlockEntityRenderer.java | 2 +- .../MixinBlockEntityRenderDispatcher.java | 4 +- .../masa/tweakeroo/mixin/MixinBlockItem.java | 6 +- .../masa/tweakeroo/mixin/MixinBossBarHud.java | 2 +- .../masa/tweakeroo/mixin/MixinBuiltChunk.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinChatHud.java | 4 +- .../masa/tweakeroo/mixin/MixinChatScreen.java | 8 +-- .../mixin/MixinChunkBuilder_BuiltChunk.java | 2 +- .../mixin/MixinClientCommandSource.java | 15 ++-- .../mixin/MixinClientPlayNetworkHandler.java | 4 +- .../mixin/MixinClientPlayerEntity.java | 24 +++---- .../MixinClientPlayerInteractionManager.java | 18 ++--- .../tweakeroo/mixin/MixinClientWorld.java | 8 +-- .../mixin/MixinClientWorld_Properties.java | 2 +- .../tweakeroo/mixin/MixinCloneCommand.java | 2 +- .../mixin/MixinCommandBlockScreen.java | 12 +--- .../mixin/MixinCreativeInventoryScreen.java | 2 +- .../mixin/MixinDimensionEffects_Nether.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinEntity.java | 44 ++++++------ .../mixin/MixinEntityRenderDispatcher.java | 2 +- .../masa/tweakeroo/mixin/MixinExplosion.java | 2 +- .../tweakeroo/mixin/MixinFillCommand.java | 2 +- .../tweakeroo/mixin/MixinGameRenderer.java | 19 +++-- .../mixin/MixinHeldItemRenderer.java | 2 +- .../masa/tweakeroo/mixin/MixinInGameHud.java | 17 +++-- .../fi/dy/masa/tweakeroo/mixin/MixinItem.java | 4 +- .../masa/tweakeroo/mixin/MixinItemEntity.java | 24 +++---- .../masa/tweakeroo/mixin/MixinItemGroup.java | 9 ++- .../masa/tweakeroo/mixin/MixinItemStack.java | 4 +- .../tweakeroo/mixin/MixinKeyboardInput.java | 2 +- .../mixin/MixinLightingProvider.java | 4 +- .../tweakeroo/mixin/MixinLivingEntity.java | 18 ++--- .../tweakeroo/mixin/MixinMinecraftClient.java | 8 +-- .../MixinMobSpawnerBlockEntityRenderer.java | 2 +- .../tweakeroo/mixin/MixinMobSpawnerLogic.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinMouse.java | 2 +- .../mixin/MixinNetherPortalBlock.java | 2 +- .../tweakeroo/mixin/MixinObserverBlock.java | 2 +- .../tweakeroo/mixin/MixinParticleManager.java | 4 +- .../tweakeroo/mixin/MixinPlayerAbilities.java | 2 +- .../tweakeroo/mixin/MixinPlayerEntity.java | 18 ++--- .../tweakeroo/mixin/MixinPresetsScreen.java | 7 +- .../tweakeroo/mixin/MixinRavagerEntity.java | 2 +- .../tweakeroo/mixin/MixinSculkSensor.java | 2 +- .../mixin/MixinServerPlayNetworkHandler.java | 2 +- .../tweakeroo/mixin/MixinShulkerBoxBlock.java | 6 +- .../tweakeroo/mixin/MixinSignBlockEntity.java | 8 +-- .../masa/tweakeroo/mixin/MixinSlimeBlock.java | 2 +- .../mixin/MixinStructureBlockBlockEntity.java | 7 +- .../mixin/MixinTeleportSpectatorMenu.java | 2 +- .../mixin/MixinThreadedAnvilChunkStorage.java | 2 +- .../masa/tweakeroo/mixin/MixinTradeOffer.java | 2 +- .../MixinUpdateStructureBlockC2SPacket.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinWindow.java | 6 +- .../dy/masa/tweakeroo/mixin/MixinWorld.java | 4 +- .../tweakeroo/mixin/MixinWorldRenderer.java | 19 +++-- .../masa/tweakeroo/renderer/RenderUtils.java | 16 ++--- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 2 - .../tweakeroo/tweaks/PlacementTweaks.java | 5 +- .../tweakeroo/util/CreativeExtraItems.java | 13 ++-- .../dy/masa/tweakeroo/util/IEntityItem.java | 2 +- .../dy/masa/tweakeroo/util/IGuiEditSign.java | 4 +- .../masa/tweakeroo/util/IItemStackLimit.java | 2 +- .../masa/tweakeroo/util/ISignTextAccess.java | 2 +- .../masa/tweakeroo/util/InventoryUtils.java | 71 +++++++------------ .../fi/dy/masa/tweakeroo/util/MiscUtils.java | 14 ++-- 86 files changed, 251 insertions(+), 348 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..48c0a02ca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip -networkTimeout=10000 -validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fi/dy/masa/tweakeroo/Reference.java b/src/main/java/fi/dy/masa/tweakeroo/Reference.java index 4e46a356e..a28135683 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Reference.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Reference.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo; -import net.minecraft.MinecraftVersion; import fi.dy.masa.malilib.util.StringUtils; public class Reference @@ -8,7 +7,4 @@ public class Reference public static final String MOD_ID = "tweakeroo"; public static final String MOD_NAME = "Tweakeroo"; public static final String MOD_VERSION = StringUtils.getModVersionString(MOD_ID); - public static final String MC_VERSION = MinecraftVersion.CURRENT.getName(); - public static final String MOD_TYPE = "fabric"; - public static final String MOD_STRING = MOD_ID+"-"+MOD_TYPE+"-"+MC_VERSION+"-"+MOD_VERSION; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java index 0e3e5dad5..734c90ab2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo.config; -import fi.dy.masa.tweakeroo.Tweakeroo; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.SignBlockEntity; @@ -185,7 +184,7 @@ private void applyValue(double gamma) @SuppressWarnings("unchecked") IMixinSimpleOption opt = (IMixinSimpleOption) (Object) this.mc.options.getGamma(); // Not sure why IntelliJ greys this out while it works? - opt.tweakeroo$setValueWithoutCheck(gamma); + opt.tweakeroo_setValueWithoutCheck(gamma); } } @@ -198,7 +197,7 @@ public FeatureCallbackSlime(ConfigBoolean feature) // If the feature is enabled on game launch, apply the overridden value here if (feature.getBooleanValue()) { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction(Blocks.STONE.getSlipperiness()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction(Blocks.STONE.getSlipperiness()); } } @@ -207,11 +206,11 @@ public void onValueChanged(ConfigBoolean config) { if (config.getBooleanValue()) { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction(Blocks.STONE.getSlipperiness()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction(Blocks.STONE.getSlipperiness()); } else { - ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).tweakeroo$setFriction((float) Configs.Internal.SLIME_BLOCK_SLIPPERINESS_ORIGINAL.getDoubleValue()); + ((IMixinAbstractBlock) Blocks.SLIME_BLOCK).setFriction((float) Configs.Internal.SLIME_BLOCK_SLIPPERINESS_ORIGINAL.getDoubleValue()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index a0918ecee..64cab5811 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -97,7 +97,6 @@ public static class Generic public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000, "The pulse length for Sculk Sensors, if the 'tweakSculkPulseLength' tweak is enabled."); public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true, "Enables tinting/coloring the Shulker Box display\nbackground texture with the dye color of the box"); public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true, "Whether or not holding shift is required for the Shulker Box preview"); - public static final ConfigInteger SHULKER_MAX_STACK_SIZE = new ConfigInteger ("shulkerMaxStackSize", 64, 1, 99, "Maximum Stack Size for Stacking Shulker Boxes.\nNote that Carpet Mod values use 1, 16, and 64 as common settings."); public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true, "This prevents the server from overriding the durability or\nstack size on items that are being used quickly for example\nwith the fast right click tweak."); public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false, "Enables the slot sync workaround at all times when the use key\nis held, not only when using fast right click or fast block placement.\nThis is mainly for other mods that may quickly use items when\nholding down use, such as Litematica's Easy Place mode."); public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true, "Whether or not to render the snap aim angle indicator"); @@ -133,7 +132,6 @@ public static class Generic REMEMBER_FLEXIBLE, SHULKER_DISPLAY_BACKGROUND_COLOR, SHULKER_DISPLAY_REQUIRE_SHIFT, - SHULKER_MAX_STACK_SIZE, SLOT_SYNC_WORKAROUND, SLOT_SYNC_WORKAROUND_ALWAYS, SNAP_AIM_INDICATOR, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 504c1a9b0..5f22d13c5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -31,7 +31,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), + //TWEAK_CREATIVE_EXTRA_ITEMS ("tweakCreativeExtraItems", false, "", "Adds custom items to item groups.\nSee Lists -> 'creativeExtraItems' to control which items are added to the groups.\nNote: Currently these will be added to the Transportation group\n(because it has the elast items), but in the future\nthe groups will be configurable per added item"), // TODO/FIXME 1.19+ the mixin needs an access widener now //TWEAK_CUSTOM_FLAT_PRESETS ("tweakCustomFlatPresets", false, "", "Allows adding custom flat world presets to the list.\nThe presets are defined in Lists -> flatWorldPresets"), TWEAK_CUSTOM_FLY_DECELERATION ("tweakCustomFlyDeceleration", false, "", "Allows changing the fly deceleration in creative or spectator mode.\nThis is mainly meant for faster deceleration ie. less \"glide\"\nwhen releasing the movement keys.\nSee Generic -> flyDecelerationRampValue"), diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index fc5d8659b..da04fcd01 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -81,7 +81,7 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } } - else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && item.toString().contains("shulker")) + else if (stack.getComponents().contains(DataComponentTypes.CONTAINER)) { if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java index c0dde54f6..e84c24f70 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java @@ -18,12 +18,7 @@ public void onWorldLoadPre(@Nullable ClientWorld worldBefore, @Nullable ClientWo @Override public void onWorldLoadPost(@Nullable ClientWorld worldBefore, @Nullable ClientWorld worldAfter, MinecraftClient mc) { - if (worldAfter == null) - { - // Turns off at logout - FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); - } - else if (worldBefore == null) + if (worldBefore == null) { if (FeatureToggle.TWEAK_GAMMA_OVERRIDE.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java index be401621a..a68042d4c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractBlock.java @@ -9,5 +9,5 @@ public interface IMixinAbstractBlock { @Mutable @Accessor("slipperiness") - void tweakeroo$setFriction(float friction); + void setFriction(float friction); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java index f7e2de3ae..e02f31c97 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAbstractHorseEntity.java @@ -9,5 +9,5 @@ public interface IMixinAbstractHorseEntity { @Accessor("items") - SimpleInventory tweakeroo$getHorseInventory(); + SimpleInventory tweakeroo_getHorseInventory(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java index d0848dece..330d4ce24 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinAxeItem.java @@ -10,5 +10,5 @@ public interface IMixinAxeItem { @Accessor("STRIPPED_BLOCKS") - static Map tweakeroo$getStrippedBlocks() { return null; } + static Map tweakeroo_getStrippedBlocks() { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java index fc9225308..926ea4b36 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinChunkLightProvider.java @@ -9,5 +9,5 @@ public interface IMixinChunkLightProvider { @Accessor("chunkProvider") - ChunkProvider tweakeroo$getChunkProvider(); + ChunkProvider tweakeroo_getChunkProvider(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java index bdf476f89..859cb42f4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinClientWorld.java @@ -10,5 +10,5 @@ public interface IMixinClientWorld { @Invoker("getMapStates") - Map tweakeroo$getMapStates(); + Map tweakeroo_getMapStates(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java index afa15a126..52c96593d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCommandBlockExecutor.java @@ -8,8 +8,8 @@ public interface IMixinCommandBlockExecutor { @Accessor("updateLastExecution") - boolean tweakeroo$getUpdateLastExecution(); + boolean getUpdateLastExecution(); @Accessor("updateLastExecution") - void tweakeroo$setUpdateLastExecution(boolean value); + void setUpdateLastExecution(boolean value); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java index 2c4dc795d..f07b543ef 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinShovelItem.java @@ -11,5 +11,5 @@ public interface IMixinShovelItem { @Accessor("PATH_STATES") - static Map tweakeroo$getPathStates() { return null; } + static Map tweakeroo_getPathStates() { return null; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java index 24f95927c..2c3042ec9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinSimpleOption.java @@ -8,5 +8,5 @@ public interface IMixinSimpleOption { @Accessor("value") - void tweakeroo$setValueWithoutCheck(T value); + void tweakeroo_setValueWithoutCheck(T value); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java index 2cb77cf11..db8dc74fc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractClientPlayerEntity.java @@ -12,7 +12,7 @@ public abstract class MixinAbstractClientPlayerEntity { @Inject(method = "isSpectator", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideIsSpectator(CallbackInfoReturnable cir) + private void overrideIsSpectator(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && CameraUtils.getFreeCameraSpectator()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java index 5d3a250fc..ed66085e9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractInventoryScreen.java @@ -23,7 +23,7 @@ private MixinAbstractInventoryScreen(T container, PlayerInventory playerInventor } @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableStatusEffectRendering(DrawContext drawContext, int mouseX, int mouseY, CallbackInfo ci) + private void disableStatusEffectRendering(DrawContext drawContext, int mouseX, int mouseY, CallbackInfo ci) { if (Configs.Disable.DISABLE_INVENTORY_EFFECTS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java index 005c19fac..15cf44b0c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java @@ -39,13 +39,13 @@ protected MixinAbstractSignEditScreen(Text textComponent) @Shadow @Final private String[] messages; @Override - public SignBlockEntity tweakeroo$getTile() + public SignBlockEntity getTile() { return this.blockEntity; } @Inject(method = "removed", at = @At("HEAD")) - private void tweakeroo$storeText(CallbackInfo ci) + private void storeText(CallbackInfo ci) { if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue()) { @@ -54,7 +54,7 @@ protected MixinAbstractSignEditScreen(Text textComponent) } @Inject(method = "init", at = @At("RETURN")) - private void tweakeroo$preventGuiOpen(CallbackInfo ci) + private void preventGuiOpen(CallbackInfo ci) { if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue()) { @@ -78,7 +78,7 @@ protected MixinAbstractSignEditScreen(Text textComponent) } @Override - public void tweakeroo$applyText(SignText text) + public void applyText(SignText text) { this.text = text; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 02e26a697..222d530cb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -1,15 +1,9 @@ package fi.dy.masa.tweakeroo.mixin; -import com.mojang.blaze3d.systems.RenderSystem; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyConstant; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.Slice; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.BackgroundRenderer; import net.minecraft.client.render.Camera; @@ -21,7 +15,6 @@ @Mixin(BackgroundRenderer.class) public abstract class MixinBackgroundRenderer { - @Unique private static boolean wasLava; @ModifyConstant( @@ -31,7 +24,7 @@ public abstract class MixinBackgroundRenderer to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), constant = @Constant(floatValue = 0.25f), require = 0) - private static float tweakeroo$reduceLavaFogStart(float original) + private static float reduceLavaFogStart(float original) { wasLava = true; @@ -50,7 +43,7 @@ public abstract class MixinBackgroundRenderer to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), constant = { @Constant(floatValue = 1.0f), @Constant(floatValue = 5.0f)}, require = 0) - private static float tweakeroo$reduceLavaFogEnd(float original) + private static float reduceLavaFogEnd(float original) { wasLava = true; @@ -65,7 +58,7 @@ public abstract class MixinBackgroundRenderer @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld$Properties;getHorizonShadingRatio()F")) - private static float tweakeroo$disableSkyDarkness(ClientWorld.Properties props) + private static float tweakeroo_disableSkyDarkness(ClientWorld.Properties props) { return Configs.Disable.DISABLE_SKY_DARKNESS.getBooleanValue() ? 1.0F : props.getHorizonShadingRatio(); } @@ -75,14 +68,14 @@ public abstract class MixinBackgroundRenderer at = @At(value = "INVOKE", remap = false, target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderFogEnd(F)V", shift = At.Shift.AFTER)) - private static void tweakeroo$disableRenderDistanceFog( + private static void disableRenderDistanceFog( Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) { if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) { - if (!thickFog && !wasLava) + if (thickFog == false && wasLava == false) { float distance = Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()); RenderSystem.setShaderFogStart(distance * 1.6F); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java index b7be69f1d..ee0a27dcd 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBatEntity.java @@ -16,7 +16,7 @@ public abstract class MixinBatEntity { @Inject(method = "canSpawn", at = @At("HEAD"), cancellable = true) - private static void tweakeroo$disableBatSpawning(EntityType type, + private static void tweakeroo_disableBatSpawning(EntityType type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java index 5da718c85..4273bb3a4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBeaconBlockEntityRenderer.java @@ -15,7 +15,7 @@ public abstract class MixinBeaconBlockEntityRenderer { @Inject(method = "render(Lnet/minecraft/block/entity/BeaconBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableBeamRendering(BeaconBlockEntity beaconBlockEntity, + private void tweakeroo_disableBeamRendering(BeaconBlockEntity beaconBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java index 35381247f..41bc67674 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockEntityRenderDispatcher.java @@ -14,7 +14,7 @@ public abstract class MixinBlockEntityRenderDispatcher "Lnet/minecraft/block/entity/BlockEntity;F" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventTileEntityRendering( + private void preventTileEntityRendering( net.minecraft.block.entity.BlockEntity tileentityIn, float partialTicks, net.minecraft.client.util.math.MatrixStack matrixStack, @@ -30,7 +30,7 @@ public abstract class MixinBlockEntityRenderDispatcher "Lnet/minecraft/block/entity/BlockEntity;" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;II)Z", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventTileEntityRendering( + private void preventTileEntityRendering( net.minecraft.block.entity.BlockEntity tileEntityIn, net.minecraft.client.util.math.MatrixStack matrixStack, net.minecraft.client.render.VertexConsumerProvider vertexConsumerProvider, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index 2211d473e..7d1fd7a05 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -32,7 +32,7 @@ private MixinBlockItem(Item.Settings builder) @Shadow public abstract Block getBlock(); @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void tweakeroo$modifyPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) + private void modifyPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { if (Configs.Generic.CLIENT_PLACEMENT_ROTATION.getBooleanValue()) { @@ -68,7 +68,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx */ @Override - public int tweakeroo$getMaxStackSize(ItemStack stack) + public int getMaxStackSize(ItemStack stack) { if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue()) { @@ -77,7 +77,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx { if (InventoryUtils.shulkerBoxHasItems(stack) == false) { - return Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue(); + return 64; } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java index db8890da2..55656cfb9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBossBarHud.java @@ -14,7 +14,7 @@ public abstract class MixinBossBarHud { @Inject(method = "render", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableBossBarRendering(DrawContext drawContext, CallbackInfo ci) + private void tweakeroo_disableBossBarRendering(DrawContext drawContext, CallbackInfo ci) { if (Configs.Disable.DISABLE_BOSS_BAR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java index 30391b2d6..24461c939 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBuiltChunk.java @@ -11,7 +11,7 @@ public abstract class MixinBuiltChunk { @Inject(method = "scheduleRebuild(Z)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableChunkReRenders(boolean important, CallbackInfo ci) + private void disableChunkReRenders(boolean important, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java index b9d3619c0..cfcda3a58 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java @@ -20,7 +20,7 @@ public abstract class MixinChatHud { @ModifyVariable(method = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), argsOnly = true) - private Text tweakeroo$addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) + private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) { if (FeatureToggle.TWEAK_CHAT_TIMESTAMP.getBooleanValue()) { @@ -34,7 +34,7 @@ public abstract class MixinChatHud @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V", ordinal = 0)) - private void tweakeroo$overrideChatBackgroundColor(DrawContext drawableHelper, int left, int top, int right, int bottom, int color) + private void overrideChatBackgroundColor(DrawContext drawableHelper, int left, int top, int right, int bottom, int color) { if (FeatureToggle.TWEAK_CHAT_BACKGROUND_COLOR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java index c58fd89dc..0cbb81d5a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java @@ -24,7 +24,7 @@ public abstract class MixinChatScreen @Mutable @Shadow private String originalChatText; @Inject(method = "removed", at = @At("HEAD")) - private void tweakeroo$storeChatText(CallbackInfo ci) + private void storeChatText(CallbackInfo ci) { if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue()) { @@ -33,7 +33,7 @@ public abstract class MixinChatScreen } @Inject(method = "(Ljava/lang/String;)V", at = @At("RETURN")) - private void tweakeroo$restoreText(String defaultText, CallbackInfo ci) + private void restoreText(String defaultText, CallbackInfo ci) { if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && !MiscUtils.getLastChatText().isEmpty()) { @@ -48,13 +48,13 @@ public abstract class MixinChatScreen at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = Shift.AFTER)) - private void tweakeroo$onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) + private void onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) { MiscUtils.setLastChatText(""); } @ModifyConstant(method = "render", constant = @Constant(intValue = Integer.MIN_VALUE)) - private int tweakeroo$overrideChatBackgroundColor(int original) + private int overrideChatBackgroundColor(int original) { if (FeatureToggle.TWEAK_CHAT_BACKGROUND_COLOR.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java index 98e682827..b221ea30d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java @@ -12,7 +12,7 @@ public abstract class MixinChunkBuilder_BuiltChunk { @Inject(method = "isChunkNonEmpty", at = @At("HEAD"), cancellable = true) - private void tweakeroo$allowEdgeChunksToRender(BlockPos pos, CallbackInfoReturnable cir) + private void allowEdgeChunksToRender(BlockPos pos, CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_RENDER_EDGE_CHUNKS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java index 5eed08468..b59a381fc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java @@ -4,7 +4,6 @@ import java.util.Collections; import java.util.Locale; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -19,7 +18,7 @@ public abstract class MixinClientCommandSource { @Inject(method = "getBlockPositionSuggestions", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onGetBlockPositionSuggestions(CallbackInfoReturnable> cir) + private void onGetBlockPositionSuggestions(CallbackInfoReturnable> cir) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -27,30 +26,28 @@ public abstract class MixinClientCommandSource mc.player != null && (mc.crosshairTarget == null || mc.crosshairTarget.getType() == HitResult.Type.MISS)) { BlockPos pos = fi.dy.masa.malilib.util.PositionUtils.getEntityBlockPos(mc.player); - cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(tweakeroo$formatInt(pos.getX()), tweakeroo$formatInt(pos.getY()), tweakeroo$formatInt(pos.getZ())))); + cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(formatInt(pos.getX()), formatInt(pos.getY()), formatInt(pos.getZ())))); } } @Inject(method = "getPositionSuggestions", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onGetPositionSuggestions(CallbackInfoReturnable> cir) + private void onGetPositionSuggestions(CallbackInfoReturnable> cir) { MinecraftClient mc = MinecraftClient.getInstance(); if (FeatureToggle.TWEAK_TAB_COMPLETE_COORDINATE.getBooleanValue() && mc.player != null && (mc.crosshairTarget == null || mc.crosshairTarget.getType() == HitResult.Type.MISS)) { - cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(tweakeroo$formatDouble(mc.player.getX()), tweakeroo$formatDouble(mc.player.getY()), tweakeroo$formatDouble(mc.player.getZ())))); + cir.setReturnValue(Collections.singleton(new CommandSource.RelativePosition(formatDouble(mc.player.getX()), formatDouble(mc.player.getY()), formatDouble(mc.player.getZ())))); } } - @Unique - private static String tweakeroo$formatDouble(double val) + private static String formatDouble(double val) { return String.format(Locale.ROOT, "%.2f", val); } - @Unique - private static String tweakeroo$formatInt(int val) + private static String formatInt(int val) { return Integer.toString(val); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java index dc7541828..bcd919dab 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayNetworkHandler.java @@ -19,7 +19,7 @@ public abstract class MixinClientPlayNetworkHandler value = "INVOKE", target = "Lnet/minecraft/screen/ScreenHandler;setStackInSlot(IILnet/minecraft/item/ItemStack;)V"), cancellable = true) - private void tweakeroo$onHandleSetSlot(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) + private void onHandleSetSlot(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) { if (PlacementTweaks.shouldSkipSlotSync(packet.getSlot(), packet.getStack())) { @@ -29,7 +29,7 @@ public abstract class MixinClientPlayNetworkHandler @Inject(method = "onDeathMessage", at = @At(value = "INVOKE", // onCombatEvent target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V")) - private void tweakeroo$onPlayerDeath(DeathMessageS2CPacket packetIn, CallbackInfo ci) + private void onPlayerDeath(DeathMessageS2CPacket packetIn, CallbackInfo ci) { MinecraftClient mc = MinecraftClient.getInstance(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java index 704e7deac..d62850445 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java @@ -4,7 +4,6 @@ import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -34,11 +33,8 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Shadow public float prevNauseaIntensity; @Shadow public float nauseaIntensity; - @Unique private final DummyMovementInput dummyMovementInput = new DummyMovementInput(null); - @Unique private Input realInput; - @Unique private float realNauseaIntensity; private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @@ -49,7 +45,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @Redirect(method = "updateNausea()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;shouldPause()Z")) - private boolean tweakeroo$onDoesGuiPauseGame(Screen gui) + private boolean onDoesGuiPauseGame(Screen gui) { // Spoof the return value to prevent entering the if block if (Configs.Disable.DISABLE_PORTAL_GUI_CLOSING.getBooleanValue()) @@ -61,7 +57,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) } @Inject(method = "updateNausea", at = @At("HEAD")) - private void tweakeroo$disableNauseaEffectPre(CallbackInfo ci) + private void disableNauseaEffectPre(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) { @@ -71,7 +67,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @Inject(method = "updateNausea", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;tickPortalCooldown()V")) - private void tweakeroo$disableNauseaEffectPost(CallbackInfo ci) + private void disableNauseaEffectPost(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) { @@ -86,7 +82,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @Inject(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;falling:Z")) - private void tweakeroo$overrideSprint(CallbackInfo ci) + private void overrideSprint(CallbackInfo ci) { if (FeatureToggle.TWEAK_PERMANENT_SPRINT.getBooleanValue() && ! this.isSprinting() && ! this.isUsingItem() && this.input.movementForward >= 0.8F && @@ -99,7 +95,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) @Redirect(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;horizontalCollision:Z")) - private boolean tweakeroo$overrideCollidedHorizontally(ClientPlayerEntity player) + private boolean overrideCollidedHorizontally(ClientPlayerEntity player) { if (Configs.Disable.DISABLE_WALL_UNSPRINT.getBooleanValue()) { @@ -114,7 +110,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) target = "Lnet/minecraft/client/option/GameOptions;sprintKey:Lnet/minecraft/client/option/KeyBinding;")), at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, ordinal = 0, shift = At.Shift.AFTER, target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksLeftToDoubleTapSprint:I")) - private void tweakeroo$disableDoubleTapSprint(CallbackInfo ci) + private void disableDoubleTapSprint(CallbackInfo ci) { if (Configs.Disable.DISABLE_DOUBLE_TAP_SPRINT.getBooleanValue()) { @@ -123,7 +119,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) } @Inject(method = "tick", at = @At("HEAD")) - private void tweakeroo$disableMovementInputsPre(CallbackInfo ci) + private void disableMovementInputsPre(CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerMovement()) { @@ -133,7 +129,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) } @Inject(method = "tick", at = @At("RETURN")) - private void tweakeroo$disableMovementInputsPost(CallbackInfo ci) + private void disableMovementInputsPost(CallbackInfo ci) { if (this.realInput != null) { @@ -143,7 +139,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) } @Inject(method = "isCamera", at = @At("HEAD"), cancellable = true) - private void tweakeroo$allowPlayerMovementInFreeCameraMode(CallbackInfoReturnable cir) + private void allowPlayerMovementInFreeCameraMode(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && CameraEntity.originalCameraWasPlayer()) { @@ -152,7 +148,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) } @Inject(method = "swingHand", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventHandSwing(Hand hand, CallbackInfo ci) + private void preventHandSwing(Hand hand, CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerInputs()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 218fe6404..937f3a4e9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -36,7 +36,7 @@ public abstract class MixinClientPlayerInteractionManager value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), cancellable = true) - private void tweakeroo$onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) + private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -54,7 +54,7 @@ public abstract class MixinClientPlayerInteractionManager "Lnet/minecraft/util/Hand;" + ")Lnet/minecraft/util/TypedActionResult;")), at = @At("RETURN")) - private void tweakeroo$onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, + private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity, MutableObject mutableObject, int sequence, CallbackInfoReturnable> cir) { @@ -68,7 +68,7 @@ public abstract class MixinClientPlayerInteractionManager ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) + private void onRightClickMouseOnEntityPre1(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -85,7 +85,7 @@ public abstract class MixinClientPlayerInteractionManager ")Lnet/minecraft/util/ActionResult;", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) + private void onRightClickMouseOnEntityPre2(PlayerEntity player, Entity target, EntityHitResult trace, Hand hand, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.onProcessRightClickPre(player, hand)) @@ -95,7 +95,7 @@ public abstract class MixinClientPlayerInteractionManager } @Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) + private void preventEntityAttacksInFreeCameraMode(PlayerEntity player, Entity target, CallbackInfo ci) { if (CameraUtils.shouldPreventPlayerInputs()) { @@ -118,7 +118,7 @@ else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockState(" + "Lnet/minecraft/util/math/BlockPos;" + ")Lnet/minecraft/block/BlockState;", ordinal = 0)) - private void tweakeroo$onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) + private void onClickBlockPre(BlockPos pos, Direction face, CallbackInfoReturnable cir) { if (this.client.player != null && this.client.world != null) { @@ -132,7 +132,7 @@ else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) } @Inject(method = "attackBlock", at = @At("HEAD"), cancellable = true) - private void tweakeroo$handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) + private void handleBreakingRestriction1(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) @@ -146,7 +146,7 @@ else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) } @Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true) // MCP: onPlayerDamageBlock - private void tweakeroo$handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) + private void handleBreakingRestriction2(BlockPos pos, Direction side, CallbackInfoReturnable cir) { if (CameraUtils.shouldPreventPlayerInputs() || PlacementTweaks.isPositionAllowedByBreakingRestriction(pos, side) == false) @@ -160,7 +160,7 @@ else if (FeatureToggle.TWEAK_WEAPON_SWITCH.getBooleanValue()) } @Inject(method = "hasLimitedAttackSpeed", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideLimitedAttackSpeed(CallbackInfoReturnable cir) + private void overrideLimitedAttackSpeed(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java index 8efe72c60..0a2b7f28a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java @@ -35,7 +35,7 @@ private MixinClientWorld(MutableWorldProperties properties, } @Inject(method = "tickEntity", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableClientEntityTicking(Entity entity, CallbackInfo ci) + private void disableClientEntityTicking(Entity entity, CallbackInfo ci) { if (Configs.Disable.DISABLE_CLIENT_ENTITY_UPDATES.getBooleanValue() && (entity instanceof PlayerEntity) == false) @@ -66,7 +66,7 @@ private void fixChunkEntityLeak(WorldChunk chunk, CallbackInfo ci) */ @Inject(method = "scheduleBlockRerenderIfNeeded", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableChunkReRenders(BlockPos pos, BlockState old, BlockState updated, CallbackInfo ci) + private void disableChunkReRenders(BlockPos pos, BlockState old, BlockState updated, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { @@ -75,7 +75,7 @@ private void fixChunkEntityLeak(WorldChunk chunk, CallbackInfo ci) } @Inject(method = "scheduleBlockRenders", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableChunkReRenders(int x, int y, int z, CallbackInfo ci) + private void disableChunkReRenders(int x, int y, int z, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { @@ -84,7 +84,7 @@ private void fixChunkEntityLeak(WorldChunk chunk, CallbackInfo ci) } @Inject(method = "updateListeners", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableChunkReRenders(BlockPos pos, BlockState oldState, BlockState newState, int flags, CallbackInfo ci) + private void disableChunkReRenders(BlockPos pos, BlockState oldState, BlockState newState, int flags, CallbackInfo ci) { if (Configs.Disable.DISABLE_CHUNK_RENDERING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java index 1080ab047..c469127ad 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld_Properties.java @@ -12,7 +12,7 @@ public class MixinClientWorld_Properties { @Inject(method = "getSkyDarknessHeight", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideSkyDarknessHeight(HeightLimitView world, CallbackInfoReturnable cir) + private void tweakeroo_overrideSkyDarknessHeight(HeightLimitView world, CallbackInfoReturnable cir) { // Disable the dark sky effect in normal situations // by moving the y threshold below the bottom of the world diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java index ed492b1e4..77b1eaed4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCloneCommand.java @@ -18,7 +18,7 @@ public abstract class MixinCloneCommand @Redirect(method = "execute", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getInt(Lnet/minecraft/world/GameRules$Key;)I")) - private static int tweakeroo$overrideBlockLimit(GameRules instance, Key rule) + private static int tweakeroo_overrideBlockLimit(GameRules instance, Key rule) { if (FeatureToggle.TWEAK_FILL_CLONE_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java index 89d9dfa30..b3b96fa4a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java @@ -4,7 +4,6 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -35,17 +34,13 @@ public abstract class MixinCommandBlockScreen extends AbstractCommandBlockScreen @Shadow private CyclingButtonWidget conditionalModeButton; @Shadow private CyclingButtonWidget redstoneTriggerButton; - @Unique private TextFieldWidget textFieldName; - @Unique private CyclingButtonWidget buttonUpdateExec; - @Unique private boolean updateExecValue; - @Unique private String lastName = ""; @Inject(method = "init", at = @At("RETURN")) - private void tweakeroo$addExtraFields(CallbackInfo ci) + private void addExtraFields(CallbackInfo ci) { if (FeatureToggle.TWEAK_COMMAND_BLOCK_EXTRA_FIELDS.getBooleanValue()) { @@ -130,7 +125,7 @@ public void tick() if (this.updateExecValue != updateExec) { this.updateExecValue = updateExec; - Text str = tweakeroo$getDisplayStringForCurrentStatus(this.updateExecValue); + Text str = getDisplayStringForCurrentStatus(this.updateExecValue); this.buttonUpdateExec.setMessage(str); this.buttonUpdateExec.setWidth(this.textRenderer.getWidth(str) + 10); } @@ -154,8 +149,7 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float partia } } - @Unique - private static Text tweakeroo$getDisplayStringForCurrentStatus(boolean updateExecValue) + private static Text getDisplayStringForCurrentStatus(boolean updateExecValue) { String translationKey = "tweakeroo.gui.button.misc.command_block.update_execution"; boolean isCurrentlyOn = ! updateExecValue; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java index b43738130..cefd1f18a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java @@ -22,7 +22,7 @@ private MixinCreativeInventoryScreen(CreativeInventoryScreen.CreativeScreenHandl // This needs to happen before the `this.handler.scrollItems(0.0F);` call. @Inject(method = "search", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/CreativeInventoryScreen$CreativeScreenHandler;scrollItems(F)V")) - private void tweakeroo$removeInfestedStoneFromCreativeSearchInventory(CallbackInfo ci) + private void tweakeroo_removeInfestedStoneFromCreativeSearchInventory(CallbackInfo ci) { if (Configs.Disable.DISABLE_CREATIVE_INFESTED_BLOCKS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java index f0e092c42..d9a632eba 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDimensionEffects_Nether.java @@ -17,7 +17,7 @@ private MixinDimensionEffects_Nether(float cloudsHeight, boolean alternateSkyCol } @Inject(method = "useThickFog", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableNetherFog(int x, int z, CallbackInfoReturnable cir) + private void disableNetherFog(int x, int z, CallbackInfoReturnable cir) { if (Configs.Disable.DISABLE_NETHER_FOG.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index 0eadf5447..c4f7bf738 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -1,9 +1,7 @@ package fi.dy.masa.tweakeroo.mixin; -import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -24,16 +22,14 @@ public abstract class MixinEntity @Shadow public float prevYaw; @Shadow public float prevPitch; - @Unique private double forcedPitch; - @Unique private double forcedYaw; @Shadow public abstract net.minecraft.util.math.Vec3d getVelocity(); @Shadow public abstract void setVelocity(net.minecraft.util.math.Vec3d velocity); @Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntity player, CallbackInfoReturnable cir) + private void overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntity player, CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_RENDER_INVISIBLE_ENTITIES.getBooleanValue()) { @@ -42,31 +38,32 @@ public abstract class MixinEntity } @Inject(method = "updateVelocity", at = @At("HEAD"), cancellable = true) - private void tweakeroo$moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec3d motion, CallbackInfo ci) + private void moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec3d motion, CallbackInfo ci) { - // I'm not sure why IntelliJ is greying this out if the code is correct. - if ((FeatureToggle.TWEAK_SNAP_AIM.getBooleanValue()) && ((Object) this instanceof ClientPlayerEntity)) + if ((Object) this instanceof ClientPlayerEntity) { - double speed = motion.lengthSquared(); - - if (speed >= 1.0E-7D) + if (FeatureToggle.TWEAK_SNAP_AIM.getBooleanValue()) { - motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); - double xFactor = Math.sin(this.yaw * Math.PI / 180D); - double zFactor = Math.cos(this.yaw * Math.PI / 180D); - net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); + double speed = motion.lengthSquared(); - this.setVelocity(this.getVelocity().add(change)); - } + if (speed >= 1.0E-7D) + { + motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); + double xFactor = Math.sin(this.yaw * Math.PI / 180D); + double zFactor = Math.cos(this.yaw * Math.PI / 180D); + net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); - ci.cancel(); + this.setVelocity(this.getVelocity().add(change)); + } + + ci.cancel(); + } } } @Inject(method = "changeLookDirection", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) + private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) { - // I'm not sure why IntelliJ is greying this out if the code is correct? if ((Object) this instanceof ClientPlayerEntity) { if (CameraUtils.shouldPreventPlayerMovement()) @@ -96,7 +93,7 @@ public abstract class MixinEntity // Not locked, or not snapping the pitch (ie. not in Pitch or Both modes) boolean updatePitch = snapAimLock == false || mode == SnapAimMode.YAW; - this.tweakeroo$updateCustomPlayerRotations(yawChange, pitchChange, updateYaw, updatePitch, pitchLimit); + this.updateCustomPlayerRotations(yawChange, pitchChange, updateYaw, updatePitch, pitchLimit); this.yaw = MiscUtils.getSnappedYaw(this.forcedYaw); this.pitch = MiscUtils.getSnappedPitch(this.forcedPitch); @@ -117,7 +114,7 @@ public abstract class MixinEntity { int pitchLimit = Configs.Generic.SNAP_AIM_PITCH_OVERSHOOT.getBooleanValue() ? 180 : 90; - this.tweakeroo$updateCustomPlayerRotations(yawChange, pitchChange, true, true, pitchLimit); + this.updateCustomPlayerRotations(yawChange, pitchChange, true, true, pitchLimit); CameraUtils.setCameraYaw((float) this.forcedYaw); CameraUtils.setCameraPitch((float) this.forcedPitch); @@ -138,8 +135,7 @@ public abstract class MixinEntity } } - @Unique - private void tweakeroo$updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) + private void updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) { if (updateYaw) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java index 033b555ed..b97cc9b1e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntityRenderDispatcher.java @@ -21,7 +21,7 @@ public abstract class MixinEntityRenderDispatcher { @Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onShouldRender(Entity entityIn, Frustum frustum, double camX, double camY, double camZ, CallbackInfoReturnable cir) + private void onShouldRender(Entity entityIn, Frustum frustum, double camX, double camY, double camZ, CallbackInfoReturnable cir) { if (Configs.Disable.DISABLE_ENTITY_RENDERING.getBooleanValue() && (entityIn instanceof PlayerEntity) == false) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java index 80be99b9c..34053e88f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java @@ -14,7 +14,7 @@ public abstract class MixinExplosion @ModifyArg(method = "affectWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V")) - private ParticleEffect tweakeroo$addParticleModify(ParticleEffect parameters) + private ParticleEffect addParticleModify(ParticleEffect parameters) { if (FeatureToggle.TWEAK_EXPLOSION_REDUCED_PARTICLES.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java index 3c6aa9e06..c361c4e0d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinFillCommand.java @@ -18,7 +18,7 @@ public abstract class MixinFillCommand @Redirect(method = "execute", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getInt(Lnet/minecraft/world/GameRules$Key;)I")) - private static int tweakeroo$overrideBlockLimit(GameRules instance, Key rule) + private static int tweakeroo_overrideBlockLimit(GameRules instance, Key rule) { if (FeatureToggle.TWEAK_FILL_CLONE_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index 62d3cb407..ffce18cb8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -4,7 +4,6 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; @@ -35,13 +34,11 @@ public abstract class MixinGameRenderer @Shadow protected abstract void bobView(MatrixStack matrices, float tickDelta); - @Unique private float realYaw; - @Unique private float realPitch; @Inject(method = "renderWorld", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onRenderWorld(CallbackInfo ci) + private void onRenderWorld(CallbackInfo ci) { if (Callbacks.skipWorldRendering) { @@ -51,7 +48,7 @@ public abstract class MixinGameRenderer @Redirect(method = "renderWorld", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) - private void tweakeroo$disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) + private void disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) { if (Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue() == false) { @@ -60,7 +57,7 @@ public abstract class MixinGameRenderer } @Inject(method = "getFov", at = @At("HEAD"), cancellable = true) - private void tweakeroo$applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) + private void applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) { if (MiscUtils.isZoomActive()) { @@ -74,7 +71,7 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) @Redirect(method = "updateCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;")) - private Entity tweakeroo$overrideCameraEntityForRayTrace(MinecraftClient mc) + private Entity overrideCameraEntityForRayTrace(MinecraftClient mc) { // Return the real player for the hit target ray tracing if the // player inputs option is enabled in Free Camera mode. @@ -99,7 +96,7 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) "Lnet/minecraft/util/math/Box;" + "Ljava/util/function/Predicate;D)" + "Lnet/minecraft/util/hit/EntityHitResult;")) - private Predicate tweakeroo$overrideTargetedEntityCheck(Predicate predicate) + private Predicate overrideTargetedEntityCheck(Predicate predicate) { if (Configs.Disable.DISABLE_DEAD_MOB_TARGETING.getBooleanValue()) { @@ -118,7 +115,7 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) @Inject(method = "renderWorld", at = @At( value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/render/GameRenderer;updateCrosshairTarget(F)V")) - private void tweakeroo$overrideRenderViewEntityPre(CallbackInfo ci) + private void overrideRenderViewEntityPre(CallbackInfo ci) { if (FeatureToggle.TWEAK_ELYTRA_CAMERA.getBooleanValue() && Hotkeys.ELYTRA_CAMERA.getKeybind().isKeybindHeld()) { @@ -134,7 +131,7 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) } @Inject(method = "renderWorld", at = @At("RETURN")) - private void tweakeroo$overrideRenderViewEntityPost(CallbackInfo ci) + private void overrideRenderViewEntityPost(CallbackInfo ci) { if (FeatureToggle.TWEAK_ELYTRA_CAMERA.getBooleanValue() && Hotkeys.ELYTRA_CAMERA.getKeybind().isKeybindHeld()) { @@ -148,7 +145,7 @@ else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) } @Inject(method = "renderHand", at = @At("HEAD"), cancellable = true) - private void tweakeroo$removeHandRendering(CallbackInfo ci) + private void removeHandRendering(CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java index 34d80553d..41a4b1ad3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHeldItemRenderer.java @@ -26,7 +26,7 @@ public float redirectedGetCooledAttackStrength(ClientPlayerEntity player, float } @Inject(method = "renderFirstPersonItem", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventOffhandRendering(AbstractClientPlayerEntity player, float tickDelta, + private void preventOffhandRendering(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index e384cc9d2..602061db9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -28,7 +28,7 @@ public abstract class MixinInGameHud @Shadow @Final private MinecraftClient client; @Inject(method = "getCameraPlayer", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overridePlayerForRendering(CallbackInfoReturnable cir) + private void overridePlayerForRendering(CallbackInfoReturnable cir) { // Fix the hotbar rendering in the Free Camera mode by using the actual player if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue() && this.client.player != null) @@ -38,9 +38,8 @@ public abstract class MixinInGameHud } @Inject(method = "renderCrosshair", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", - ordinal = 0), cancellable = true) - private void tweakeroo$overrideCursorRender(CallbackInfo ci) + target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z", ordinal = 0), cancellable = true) + private void overrideCursorRender(CallbackInfo ci) { if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { @@ -51,9 +50,9 @@ public abstract class MixinInGameHud @Inject(method = "renderPlayerList", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", - ordinal = 1, shift = At.Shift.AFTER)) - private void tweakeroo$alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) + target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", + ordinal = 1, shift = At.Shift.AFTER)) + private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) { if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { @@ -66,7 +65,7 @@ public abstract class MixinInGameHud } @Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableScoreboardRendering(CallbackInfo ci) + private void disableScoreboardRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) { @@ -75,7 +74,7 @@ public abstract class MixinInGameHud } @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableStatusEffectHudRendering(CallbackInfo ci) + private void disableStatusEffectHudRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_STATUS_EFFECT_HUD.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index c41fe03e4..c405ba383 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -11,14 +11,14 @@ public abstract class MixinItem implements IItemStackLimit @Shadow public abstract Item asItem(); @Override - public int tweakeroo$getMaxStackSize(net.minecraft.item.ItemStack stack) + public int getMaxStackSize(net.minecraft.item.ItemStack stack) { return this.asItem().getMaxCount(); } /* // TODO 1.19.3+ @Inject(method = "getGroup", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideItemGroup(CallbackInfoReturnable cir) + private void overrideItemGroup(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CREATIVE_EXTRA_ITEMS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 743c5b981..5027a1782 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -1,14 +1,11 @@ package fi.dy.masa.tweakeroo.mixin; -import fi.dy.masa.tweakeroo.Tweakeroo; -import fi.dy.masa.tweakeroo.config.Configs; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - import net.minecraft.block.ShulkerBoxBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -16,7 +13,6 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; - import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.IEntityItem; import fi.dy.masa.tweakeroo.util.InventoryUtils; @@ -35,13 +31,13 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) } @Override - public int tweakeroo$getPickupDelay() + public int getPickupDelay() { return this.pickupDelay; } @Inject(method = "(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", at = @At("RETURN")) - private void tweakeroo$removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) + private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) { if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { @@ -56,7 +52,7 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) } @Inject(method = "canMerge()Z", at = @At("HEAD"), cancellable = true) - private void tweakeroo$allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) + private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { @@ -68,7 +64,7 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) && this.pickupDelay != 32767 && this.itemAge != -32768 && this.itemAge < 6000 - && stack.getCount() < Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue(); + && stack.getCount() < 64; cir.setReturnValue(canMerge); } @@ -76,7 +72,7 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) } @Inject(method = "tryMerge(Lnet/minecraft/entity/ItemEntity;)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) + private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) { // I don't know why IntelliJ greys this out while it is working well if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) @@ -87,16 +83,16 @@ public MixinItemEntity(EntityType entityTypeIn, World worldIn) if (stackSelf.getItem() instanceof BlockItem && ((BlockItem) stackSelf.getItem()).getBlock() instanceof ShulkerBoxBlock && stackSelf.getItem() == stackOther.getItem() && - fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) == false && - // Only stack up to 64, and don't steal from other stacks that are larger - stackSelf.getCount() < Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue() && stackSelf.getCount() >= stackOther.getCount() && + fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) == false && + // Only stack up to SHULKER_MAX_STACK_SIZE, and don't steal from other stacks that are larger + stackSelf.getCount() < 64 && stackSelf.getCount() >= stackOther.getCount() && ItemStack.areItemsAndComponentsEqual(stackSelf, stackOther)) { - int amount = Math.min(stackOther.getCount(), Configs.Generic.SHULKER_MAX_STACK_SIZE.getIntegerValue() - stackSelf.getCount()); + int amount = Math.min(stackOther.getCount(), 64 - stackSelf.getCount()); stackSelf.increment(amount); self.setStack(stackSelf); - this.pickupDelay = Math.max(((IEntityItem) other).tweakeroo$getPickupDelay(), this.pickupDelay); + this.pickupDelay = Math.max(((IEntityItem) other).getPickupDelay(), this.pickupDelay); this.itemAge = Math.min(other.getItemAge(), this.itemAge); if (amount >= stackOther.getCount()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java index 75426bfa5..b8e26c1c9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemGroup.java @@ -5,16 +5,15 @@ @Mixin(net.minecraft.item.ItemGroup.class) public abstract class MixinItemGroup { - // TODO 1.19.3+ - /* + /* // TODO 1.19.3+ @Inject(method = "appendStacks", at = @At("RETURN")) - private void tweakeroo$appendCustomItems(net.minecraft.util.collection.DefaultedList stacks, CallbackInfo ci) + private void appendCustomItems(net.minecraft.util.collection.DefaultedList stacks, CallbackInfo ci) { if (FeatureToggle.TWEAK_CREATIVE_EXTRA_ITEMS.getBooleanValue()) { - List extraStacks = CreativeExtraItems.getExtraStacksForGroup((net.minecraft.item.ItemGroup) (Object) this); + List extraStacks = CreativeExtraItems.getExtraStacksForGroup((net.minecraft.item.ItemGroup) (Object) this); stacks.addAll(extraStacks); } } - */ + */ } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index bfbad5a91..3e95230d1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -16,8 +16,8 @@ public abstract class MixinItemStack public abstract Item getItem(); @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) - public void tweakeroo$getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) + public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) { - ci.setReturnValue(((IItemStackLimit) this.getItem()).tweakeroo$getMaxStackSize((ItemStack) (Object) this)); + ci.setReturnValue(((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this)); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java index 7a5abdcd0..a5b79f484 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java @@ -22,7 +22,7 @@ public abstract class MixinKeyboardInput extends Input ordinal = 0, shift = Shift.AFTER, opcode = Opcodes.PUTFIELD)) - private void tweakeroo$customMovement(boolean val1, float f, CallbackInfo ci) + private void customMovement(boolean val1, float f, CallbackInfo ci) { if (FeatureToggle.TWEAK_MOVEMENT_KEYS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java index 9aec67fbc..3ce40b1b3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLightingProvider.java @@ -19,11 +19,11 @@ public abstract class MixinLightingProvider @Shadow @Final @Nullable private ChunkLightProvider blockLightProvider; @Inject(method = "checkBlock", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableLightUpdates(BlockPos pos, CallbackInfo ci) + private void disableLightUpdates(BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_CLIENT_LIGHT_UPDATES.getBooleanValue() && this.blockLightProvider != null && - ((IMixinChunkLightProvider) this.blockLightProvider).tweakeroo$getChunkProvider().getWorld() == MinecraftClient.getInstance().world) + ((IMixinChunkLightProvider) this.blockLightProvider).tweakeroo_getChunkProvider().getWorld() == MinecraftClient.getInstance().world) { ci.cancel(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index f536772b9..b996a5a58 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo.mixin; -import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -27,7 +26,7 @@ private MixinLivingEntity(EntityType type, World worldIn) @Redirect(method = "travel", at = @At(value = "FIELD", ordinal = 1, target = "Lnet/minecraft/world/World;isClient:Z")) - private boolean tweakeroo$fixElytraLanding(World world) + private boolean fixElytraLanding(World world) { return world.isClient && (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || @@ -37,7 +36,7 @@ private MixinLivingEntity(EntityType type, World worldIn) @Inject(method = "tickStatusEffects", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/entity/data/DataTracker;get(Lnet/minecraft/entity/data/TrackedData;)Ljava/lang/Object;"), cancellable = true) - private void tweakeroo$removeOwnPotionEffects(CallbackInfo ci) + private void removeOwnPotionEffects(CallbackInfo ci) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -54,17 +53,12 @@ private MixinLivingEntity(EntityType type, World worldIn) @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;tickFallFlying()V")) - private void tweakeroo$applyCustomDeceleration(CallbackInfo ci) + private void tweakeroo_applyCustomDeceleration(CallbackInfo ci) { - MinecraftClient mc = MinecraftClient.getInstance(); - - if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue()) + if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue() && + ((Entity) this) == MinecraftClient.getInstance().player) { - // I don't know why IntelliJ is greying this out when it works fine. - if (((Object) this) == (LivingEntity) mc.player) - { - MiscUtils.handlePlayerDeceleration(); - } + MiscUtils.handlePlayerDeceleration(); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java index 00226701b..7ed44ef32 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java @@ -78,7 +78,7 @@ public void tweakeroo_invokeDoItemUse() "Lnet/minecraft/util/math/BlockPos;" + "Lnet/minecraft/util/math/Direction;)Z") }) - private void tweakeroo$onLeftClickMousePre(CallbackInfoReturnable cir) + private void onLeftClickMousePre(CallbackInfoReturnable cir) { PlacementTweaks.onLeftClickMousePre(); } @@ -86,7 +86,7 @@ public void tweakeroo_invokeDoItemUse() @Inject(method = "doAttack", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) - private void tweakeroo$onLeftClickMousePost(CallbackInfoReturnable cir) + private void onLeftClickMousePost(CallbackInfoReturnable cir) { PlacementTweaks.onLeftClickMousePost(); } @@ -98,7 +98,7 @@ public void tweakeroo_invokeDoItemUse() "Lnet/minecraft/util/Hand;" + "Lnet/minecraft/util/hit/BlockHitResult;" + ")Lnet/minecraft/util/ActionResult;")) - private ActionResult tweakeroo$onProcessRightClickBlock( + private ActionResult onProcessRightClickBlock( ClientPlayerInteractionManager controller, ClientPlayerEntity player, Hand hand, @@ -108,7 +108,7 @@ public void tweakeroo_invokeDoItemUse() } @Inject(method = "handleInputEvents", at = @At("HEAD")) - private void tweakeroo$onProcessKeybindsPre(CallbackInfo ci) + private void onProcessKeybindsPre(CallbackInfo ci) { if (this.currentScreen == null) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java index 3266d20e5..3fe75fe16 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerBlockEntityRenderer.java @@ -12,7 +12,7 @@ public abstract class MixinMobSpawnerBlockEntityRenderer { @Inject(method = "render(Lnet/minecraft/block/entity/MobSpawnerBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$cancelRender(CallbackInfo ci) + private void cancelRender(CallbackInfo ci) { if (Configs.Disable.DISABLE_MOB_SPAWNER_MOB_RENDER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java index bd3c4dfa2..c74c377af 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMobSpawnerLogic.java @@ -15,7 +15,7 @@ public abstract class MixinMobSpawnerLogic { @Inject(method = "clientTick", at = @At("HEAD"), cancellable = true) - private void tweakeroo$cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) + private void cancelParticleRendering(World world, BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_MOB_SPAWNER_MOB_RENDER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java index 09d9c9239..941125bc0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMouse.java @@ -11,7 +11,7 @@ public abstract class MixinMouse { @ModifyVariable(method = "onMouseScroll", ordinal = 1, at = @At("HEAD"), argsOnly = true) - private double tweakeroo$applyHorizontalScroll(double vertical, long argWindow, double argHorizontal, double argVertical) + private double applyHorizontalScroll(double vertical, long argWindow, double argHorizontal, double argVertical) { if (Configs.Fixes.MAC_HORIZONTAL_SCROLL.getBooleanValue() && MinecraftClient.IS_SYSTEM_MAC && vertical == 0) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java index 176a1eb53..a1bccb1e0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinNetherPortalBlock.java @@ -14,7 +14,7 @@ public abstract class MixinNetherPortalBlock { @Redirect(method = "randomDisplayTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFZ)V")) - private void tweakeroo$disablePortalSound(World instance, double x, double y, double z, SoundEvent sound, + private void tweakeroo_disablePortalSound(World instance, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean useDistance) { if (Configs.Disable.DISABLE_NETHER_PORTAL_SOUND.getBooleanValue() == false) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java index 69581e721..377dc98db 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java @@ -20,7 +20,7 @@ public MixinObserverBlock(Block.Settings builder) } @Inject(method = "scheduleTick", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventTrigger(WorldAccess worldIn, BlockPos pos, CallbackInfo ci) + private void preventTrigger(WorldAccess worldIn, BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_OBSERVER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java index 3a7b6862e..1358573f5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinParticleManager.java @@ -14,7 +14,7 @@ public abstract class MixinParticleManager { @Inject(method = "addBlockBreakParticles", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onAddBlockDestroyEffects(BlockPos pos, BlockState state, CallbackInfo ci) + private void onAddBlockDestroyEffects(BlockPos pos, BlockState state, CallbackInfo ci) { if (Configs.Disable.DISABLE_BLOCK_BREAK_PARTICLES.getBooleanValue()) { @@ -23,7 +23,7 @@ public abstract class MixinParticleManager } @Inject(method = "addParticle(Lnet/minecraft/client/particle/Particle;)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableAllParticles(Particle effect, CallbackInfo ci) + private void disableAllParticles(Particle effect, CallbackInfo ci) { if (Configs.Disable.DISABLE_PARTICLES.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java index a047843e9..c28a2a694 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerAbilities.java @@ -14,7 +14,7 @@ public abstract class MixinPlayerAbilities { @Inject(method = "getFlySpeed", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideFlySpeed(CallbackInfoReturnable cir) + private void overrideFlySpeed(CallbackInfoReturnable cir) { PlayerEntity player = MinecraftClient.getInstance().player; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 4eb8f814a..f80e33e35 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -13,6 +13,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; + import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -27,7 +28,7 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor } @Inject(method = "method_30263", at = @At("HEAD"), cancellable = true) - private void tweakeroo$restore_1_15_2_sneaking(CallbackInfoReturnable cir) + private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SNEAK_1_15_2.getBooleanValue()) { @@ -37,28 +38,24 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor @Redirect(method = "adjustMovementForSneaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) - private boolean tweakeroo$fakeSneaking(PlayerEntity entity) + private boolean fakeSneaking(PlayerEntity entity) { - if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue()) + if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && (Object) this instanceof ClientPlayerEntity) { - if ((Object) this instanceof ClientPlayerEntity) - { - return true; - } + return true; } return this.clipAtLedge(); } @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideBlockReachDistance(CallbackInfoReturnable cir) + private void overrideBlockReachDistance(CallbackInfoReturnable cir) { MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { if (server != null) { - // For Single Player, use the configured value. cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } else @@ -72,14 +69,13 @@ protected MixinPlayerEntity(EntityType entityType_1, Wor } @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideEntityReachDistance(CallbackInfoReturnable cir) + private void overrideEntityReachDistance(CallbackInfoReturnable cir) { MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { if (server != null) { - // For Single Player, use the configured value. cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } else diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java index d228a740a..a8829a712 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java @@ -5,7 +5,7 @@ public abstract class MixinPresetsScreen { /* @Inject(method = "init", at = @At("HEAD")) - private void tweakeroo$addCustomEntries(CallbackInfo ci) + private void addCustomEntries(CallbackInfo ci) { if (FeatureToggle.TWEAK_CUSTOM_FLAT_PRESETS.getBooleanValue()) { @@ -23,7 +23,7 @@ public abstract class MixinPresetsScreen { String str = presetStrings.get(i); - if (this.tweakeroo$registerPresetFromString(str) && PRESETS.size() > vanillaEntries) + if (this.registerPresetFromString(str) && PRESETS.size() > vanillaEntries) { Object o = PRESETS.remove(PRESETS.size() - 1); PRESETS.add(0, o); @@ -32,8 +32,7 @@ public abstract class MixinPresetsScreen } } - @Unique - private boolean tweakeroo$registerPresetFromString(String str) + private boolean registerPresetFromString(String str) { Matcher matcher = MiscUtils.PATTERN_WORLD_PRESET.matcher(str); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java index c8af11305..0c2e7ff82 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinRavagerEntity.java @@ -12,7 +12,7 @@ public abstract class MixinRavagerEntity @Redirect(method = "tickMovement", at = @At( value = "FIELD", target = "Lnet/minecraft/entity/mob/RavagerEntity;horizontalCollision:Z")) - private boolean tweakeroo$fixDontBreakBlocksOnClient(RavagerEntity entity) + private boolean fixDontBreakBlocksOnClient(RavagerEntity entity) { if (Configs.Fixes.RAVAGER_CLIENT_BLOCK_BREAK_FIX.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java index f7763a89c..ec82e3a2a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSculkSensor.java @@ -12,7 +12,7 @@ public abstract class MixinSculkSensor { @Inject(method = "getCooldownTime", at = @At(value = "HEAD"), require = 0, cancellable = true) - private void tweakeroo$modifyPulseLength(CallbackInfoReturnable cir) + private void modifyPulseLength(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_SCULK_PULSE_LENGTH.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java index 4f02e0789..a30648d4c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerPlayNetworkHandler.java @@ -13,7 +13,7 @@ public class MixinServerPlayNetworkHandler @Redirect(method = "onPlayerInteractBlock", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;subtract(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;")) - private Vec3d tweakeroo$removeHitPosCheck(Vec3d hitVec, Vec3d blockCenter) + private Vec3d tweakeroo_removeHitPosCheck(Vec3d hitVec, Vec3d blockCenter) { if (Configs.Generic.ITEM_USE_PACKET_CHECK_BYPASS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index cb2ab4d9d..177fae1f1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -1,13 +1,13 @@ package fi.dy.masa.tweakeroo.mixin; import java.util.List; -import net.minecraft.client.item.TooltipType; -import net.minecraft.item.Item; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.block.ShulkerBoxBlock; +import net.minecraft.client.item.TooltipType; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import fi.dy.masa.tweakeroo.config.Configs; @@ -16,7 +16,7 @@ public abstract class MixinShulkerBoxBlock { @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void tweakeroo$removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) + private void removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) { if (Configs.Disable.DISABLE_SHULKER_BOX_TOOLTIP.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index a313c51c3..255fd73e3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo.mixin; -import fi.dy.masa.tweakeroo.Tweakeroo; import net.minecraft.client.gui.screen.ingame.HangingSignEditScreen; import net.minecraft.registry.RegistryWrapper; import org.spongepowered.asm.mixin.Mixin; @@ -36,7 +35,7 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP } @Inject(method = "readNbt", at = @At("RETURN")) - private void tweakeroo$restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) + private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) { // Restore the copied/pasted text after the TileEntity sync overrides it with empty lines if (FeatureToggle.TWEAK_SIGN_COPY.getBooleanValue() && this.getWorld() != null && this.getWorld().isClient) @@ -45,8 +44,7 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP if (mc.currentScreen instanceof SignEditScreen || mc.currentScreen instanceof HangingSignEditScreen) { - // I do not know why IntelliJ is greying this out when it works fine. - if (((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) + if (((IGuiEditSign) mc.currentScreen).getTile() == (Object) this) { MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); } @@ -55,7 +53,7 @@ private MixinSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockP } @Override - public SignText tweakeroo$getText(boolean front) + public SignText getText(boolean front) { return front ? this.frontText : this.backText; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java index 53919af5c..50a470b8f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSlimeBlock.java @@ -25,7 +25,7 @@ public MixinSlimeBlock(AbstractBlock.Settings settings) } @Inject(method = "onSteppedOn", at = @At("HEAD"), cancellable = true) - private void tweakeroo$onEntityWalkOnSlime(World worldIn, BlockPos pos, BlockState state, Entity entityIn, CallbackInfo ci) + private void onEntityWalkOnSlime(World worldIn, BlockPos pos, BlockState state, Entity entityIn, CallbackInfo ci) { if (Configs.Disable.DISABLE_SLIME_BLOCK_SLOWDOWN.getBooleanValue() && entityIn instanceof PlayerEntity) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java index c61b39c98..5b87f9a9f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java @@ -5,8 +5,6 @@ import java.util.List; import java.util.Objects; import java.util.stream.Stream; - -import fi.dy.masa.tweakeroo.Tweakeroo; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; @@ -39,7 +37,7 @@ private MixinStructureBlockBlockEntity(BlockEntityType blockEntityType, Block to = @At(value = "FIELD", target = "Lnet/minecraft/block/entity/StructureBlockBlockEntity;size:Lnet/minecraft/util/math/Vec3i;")), constant = { @Constant(intValue = -48), @Constant(intValue = 48) }, require = 0) - private int tweakeroo$overrideMaxSize(int original) + private int overrideMaxSize(int original) { if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { @@ -51,9 +49,8 @@ private MixinStructureBlockBlockEntity(BlockEntityType blockEntityType, Block } @Inject(method = "streamCornerPos", at = @At("HEAD"), cancellable = true) - private void tweakeroo$overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoReturnable> cir) + private void overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoReturnable> cir) { - // I do not know why IntelliJ is greying this out, it appears to function as expected. if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { BlockPos pos = this.getPos(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java index af6700479..6c2c260e3 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTeleportSpectatorMenu.java @@ -23,7 +23,7 @@ public abstract class MixinTeleportSpectatorMenu @Shadow @Final @Mutable private List elements; @Inject(method = "(Ljava/util/Collection;)V", at = @At("RETURN")) - private void tweakeroo$allowSpectatorTeleport(Collection profiles, CallbackInfo ci) + private void allowSpectatorTeleport(Collection profiles, CallbackInfo ci) { if (FeatureToggle.TWEAK_SPECTATOR_TELEPORT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java index 5839d459c..27cd43ff9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java @@ -13,7 +13,7 @@ public abstract class MixinThreadedAnvilChunkStorage { @Inject(method = "unloadChunks", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;chunkHolders:Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;")) - private void tweakeroo$disableSaving20ChunksEveryTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) + private void tweakeroo_disableSaving20ChunksEveryTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) { if (Configs.Disable.DISABLE_CONSTANT_CHUNK_SAVING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java index bffb26ea2..782bca675 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinTradeOffer.java @@ -16,7 +16,7 @@ public abstract class MixinTradeOffer @Shadow @Mutable @Final private int maxUses; @Inject(method = "use", at = @At("RETURN")) - private void tweakeroo$preventTradeLocking(CallbackInfo ci) + private void preventTradeLocking(CallbackInfo ci) { if (Configs.Disable.DISABLE_VILLAGER_TRADE_LOCKING.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java index f91d983a2..633014fed 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinUpdateStructureBlockC2SPacket.java @@ -19,7 +19,7 @@ public abstract class MixinUpdateStructureBlockC2SPacket to = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/network/packet/c2s/play/UpdateStructureBlockC2SPacket;mirror:Lnet/minecraft/util/BlockMirror;")), constant = { @Constant(intValue = -48), @Constant(intValue = 48) }, require = 0) - private int tweakeroo$overrideStructureBlockSizeLimit(int original) + private int tweakeroo_overrideStructureBlockSizeLimit(int original) { if (FeatureToggle.TWEAK_STRUCTURE_BLOCK_LIMIT.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java index 6df76f76a..e984386d5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWindow.java @@ -20,7 +20,7 @@ public abstract class MixinWindow @Shadow public abstract int getHeight(); @Inject(method = "getScaleFactor", at = @At("HEAD"), cancellable = true) - private void tweakeroo$customGuiScaleGetScale(CallbackInfoReturnable cir) + private void tweakeroo_customGuiScaleGetScale(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) @@ -35,7 +35,7 @@ public abstract class MixinWindow } @Inject(method = "getScaledWidth", at = @At("HEAD"), cancellable = true) - private void tweakeroo$customGuiScaleGetWidth(CallbackInfoReturnable cir) + private void tweakeroo_customGuiScaleGetWidth(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) @@ -50,7 +50,7 @@ public abstract class MixinWindow } @Inject(method = "getScaledHeight", at = @At("HEAD"), cancellable = true) - private void tweakeroo$customGuiScaleGetHeight(CallbackInfoReturnable cir) + private void tweakeroo_customGuiScaleGetHeight(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_CUSTOM_INVENTORY_GUI_SCALE.getBooleanValue() && MinecraftClient.getInstance().currentScreen instanceof HandledScreen) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java index 2c3690ebf..a24df6f7c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorld.java @@ -14,7 +14,7 @@ public abstract class MixinWorld { @Inject(method = "tickBlockEntities", at = @At("HEAD"), cancellable = true) - private void tweakeroo$disableBlockEntityTicking(CallbackInfo ci) + private void disableBlockEntityTicking(CallbackInfo ci) { if (Configs.Disable.DISABLE_TILE_ENTITY_TICKING.getBooleanValue()) { @@ -23,7 +23,7 @@ public abstract class MixinWorld } @Inject(method = "tickEntity(Ljava/util/function/Consumer;Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true) - private void tweakeroo$preventEntityTicking(Consumer consumer, T entityIn, CallbackInfo ci) + private void preventEntityTicking(Consumer consumer, T entityIn, CallbackInfo ci) { if (Configs.Disable.DISABLE_ENTITY_TICKING.getBooleanValue() && (entityIn instanceof PlayerEntity) == false) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index eac568187..5b2954bfb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -4,7 +4,6 @@ import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -27,13 +26,11 @@ public abstract class MixinWorldRenderer @Shadow private int cameraChunkX; @Shadow private int cameraChunkZ; - @Unique private int lastUpdatePosX; - @Unique private int lastUpdatePosZ; @Inject(method = "tickRainSplashing", at = @At("HEAD"), cancellable = true) // renderRain - private void tweakeroo$cancelRainRender(Camera camera, CallbackInfo ci) + private void cancelRainRender(Camera camera, CallbackInfo ci) { if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) { @@ -42,7 +39,7 @@ public abstract class MixinWorldRenderer } @Inject(method = "renderWeather", at = @At("HEAD"), cancellable = true) - private void tweakeroo$cancelRainRender(LightmapTextureManager lightmap, float partialTicks, double x, double y, double z, CallbackInfo ci) + private void cancelRainRender(LightmapTextureManager lightmap, float partialTicks, double x, double y, double z, CallbackInfo ci) { if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) { @@ -52,7 +49,7 @@ public abstract class MixinWorldRenderer @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void tweakeroo$preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -62,7 +59,7 @@ public abstract class MixinWorldRenderer @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void tweakeroo$postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } @@ -70,7 +67,7 @@ public abstract class MixinWorldRenderer // Allow rendering the client player entity by spoofing one of the entity rendering conditions while in Free Camera mode @Redirect(method = "render", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;getFocusedEntity()Lnet/minecraft/entity/Entity;", ordinal = 3)) - private Entity tweakeroo$allowRenderingClientPlayerInFreeCameraMode(Camera camera) + private Entity allowRenderingClientPlayerInFreeCameraMode(Camera camera) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -85,7 +82,7 @@ public abstract class MixinWorldRenderer @Inject(method = "setupTerrain", require = 0, at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/render/WorldRenderer;lastCameraX:D")) - private void tweakeroo$rebuildChunksAroundCamera1( + private void rebuildChunksAroundCamera1( Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) @@ -101,7 +98,7 @@ public abstract class MixinWorldRenderer @Inject(method = "setupTerrain", require = 0, at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/client/render/BuiltChunkStorage;updateCameraPosition(DD)V")) - private void tweakeroo$rebuildChunksAroundCamera2( + private void rebuildChunksAroundCamera2( Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator, CallbackInfo ci) { // Mark the chunks at the edge of the free camera's render range for rebuilding @@ -114,7 +111,7 @@ public abstract class MixinWorldRenderer int x = MathHelper.floor(camera.getPos().x) >> 4; int z = MathHelper.floor(camera.getPos().z) >> 4; CameraUtils.markChunksForRebuild(x, z, this.lastUpdatePosX, this.lastUpdatePosZ); - // TODO could send this to ServUX + // Could send this to ServuX in the future } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 102aca050..8bb7872c8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -169,7 +169,7 @@ else if (entity instanceof VillagerEntity) } else if (entity instanceof AbstractHorseEntity) { - inv = ((IMixinAbstractHorseEntity) entity).tweakeroo$getHorseInventory(); + inv = ((IMixinAbstractHorseEntity) entity).tweakeroo_getHorseInventory(); } } @@ -271,17 +271,15 @@ public static float getLavaFogDistance(Entity entity, float originalFog) final int aqua = EnchantmentHelper.getEquipmentLevel(Enchantments.AQUA_AFFINITY, living); float fog = originalFog; - // With the new Vanilla changes, the old values were Overpowered. - // (was: 1.6f, and resp * 1.6f) -- getting values as high as 38.4f, + // With the Vanilla changes, the old values were very Overpowered. + // (was: *1.6f, and *(resp * 1.6f)) -- getting values as high as 38.4f, // when we really only need around 15.0f at the most for full visibility. - - // Max +6.2f (Additive) --> these values feel about right - // 5.0f for Fire Res (Max: 12.7f) - // 1.0f no Fire Res (Max: 7.2f) + // 5.0f w/ Fire Res (Max: 13.5f) + // 1.0f no Fire Res (Max: 7.2f) if (originalFog > 3.0f) { - fog += 1.5f; // Fire Res bonus +1.5f + fog += 2.3f; // Fire Res bonus +2.3f } if (aqua > 0) { @@ -307,7 +305,6 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) int height = GuiUtils.getScaledWindowHeight(); Camera camera = mc.gameRenderer.getCamera(); - // WorldRenderer changed to Matrix4fStack Matrix4fStack matrix4fStack = RenderSystem.getModelViewStack(); matrix4fStack.pushMatrix(); matrix4fStack.translate((float) (width / 2.0), (float) (height / 2.0), zLevel); @@ -315,7 +312,6 @@ public static void renderDirectionsCursor(float zLevel, float partialTicks) float yaw = camera.getYaw(); matrix4fStack.rotateXYZ(-(pitch) * ((float) (Math.PI / 180.0)), yaw * ((float) (Math.PI / 180.0)), 0.0F); - // Fix rotation values using matrix4fRotateFix() matrix4fStack.rotateX(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(-pitch)); matrix4fStack.rotateY(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(yaw)); diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index 796e12c7c..c8f13a822 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -128,8 +128,6 @@ public static void onTick(MinecraftClient mc) public static void onGameLoop(MinecraftClient mc) { - if (mc == null) - return; PlacementTweaks.onTick(mc); // Reset the counters after rendering each frame diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 47228106b..bc76cd1f5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -63,7 +63,7 @@ public class PlacementTweaks private static Direction sideFirstBreaking = null; private static Direction sideRotatedFirst = null; private static float playerYawFirst; - private static final ItemStack[] stackBeforeUse = new ItemStack[] { ItemStack.EMPTY, ItemStack.EMPTY }; + private static ItemStack[] stackBeforeUse = new ItemStack[] { ItemStack.EMPTY, ItemStack.EMPTY }; private static boolean isFirstClick; private static boolean isEmulatedClick; private static boolean firstWasRotation; @@ -127,7 +127,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) ItemStack stackOriginal = player.getStackInHand(hand); if (FeatureToggle.TWEAK_HAND_RESTOCK.getBooleanValue() && - stackOriginal.isEmpty() == false && + stackOriginal.isEmpty() == false && canUseItemWithRestriction(HAND_RESTOCK_RESTRICTION, stackOriginal)) { if (isEmulatedClick == false) @@ -590,7 +590,6 @@ else if (flexible == false || rotation == false) if (canPlaceBlockIntoPosition(world, posNew, ctx)) { - // Re-enable Debug logging for now //Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: {}, side: {}, part: {}, hitVec: {}", posNew, side, hitPart, hitVec); return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index 7e8871d88..06e09baab 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -1,19 +1,16 @@ package fi.dy.masa.tweakeroo.util; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.List; -import javax.annotation.Nullable; import com.google.common.collect.ArrayListMultimap; -import fi.dy.masa.malilib.util.InventoryUtils; import net.minecraft.block.InfestedBlock; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemGroups; -import net.minecraft.item.ItemStack; +import net.minecraft.item.*; import net.minecraft.text.TextContent; import net.minecraft.text.TranslatableTextContent; import net.minecraft.util.collection.DefaultedList; +import fi.dy.masa.malilib.util.InventoryUtils; +import fi.dy.masa.tweakeroo.Tweakeroo; public class CreativeExtraItems { @@ -60,7 +57,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) return; } - //Tweakeroo.logger.info("Adding extra items to creative inventory group '{}'", group.getDisplayName().getString()); + Tweakeroo.logger.info("Adding extra items to creative inventory group '{}'", group.getDisplayName().getString()); for (String str : items) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java b/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java index 4eacfc035..542481080 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IEntityItem.java @@ -2,5 +2,5 @@ public interface IEntityItem { - int tweakeroo$getPickupDelay(); + int getPickupDelay(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java index 556179d17..2d979b710 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java @@ -5,7 +5,7 @@ public interface IGuiEditSign { - SignBlockEntity tweakeroo$getTile(); + SignBlockEntity getTile(); - void tweakeroo$applyText(SignText text); + void applyText(SignText text); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java index 1649349ff..62a4ad177 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java @@ -4,5 +4,5 @@ public interface IItemStackLimit { - int tweakeroo$getMaxStackSize(ItemStack stack); + int getMaxStackSize(ItemStack stack); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java index 9c4c2fb93..02e5ef45c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java @@ -4,5 +4,5 @@ public interface ISignTextAccess { - SignText tweakeroo$getText(boolean front); + SignText getText(boolean front); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 5bf9cb7ad..d226cc013 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1,14 +1,12 @@ package fi.dy.masa.tweakeroo.util; +import javax.annotation.Nullable; import java.util.*; import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.Nullable; - import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; -import net.minecraft.component.ComponentMap; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.AttributeModifiersComponent; import net.minecraft.component.type.ContainerComponent; @@ -20,14 +18,7 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ElytraItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.SwordItem; -import net.minecraft.item.ToolItem; +import net.minecraft.item.*; import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket; import net.minecraft.registry.Registries; import net.minecraft.screen.PlayerScreenHandler; @@ -42,7 +33,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; - import fi.dy.masa.malilib.gui.Message; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; @@ -451,33 +441,23 @@ private static boolean makesMoreDamage(ItemStack testedStack, ItemStack previous private static float getBaseAttackDamage(ItemStack stack) { Item item = stack.getItem(); - ComponentMap data = stack.getComponents(); + if ((item instanceof SwordItem) == false && (item instanceof MiningToolItem) == false) + return 0F; - if (data != null && data.contains(DataComponentTypes.ATTRIBUTE_MODIFIERS)) + AttributeModifiersComponent itemAttribute = stack.getComponents().get(DataComponentTypes.ATTRIBUTE_MODIFIERS); + + if (itemAttribute != null && itemAttribute.equals(AttributeModifiersComponent.DEFAULT) == false) { - AttributeModifiersComponent itemAttribute = data.get(DataComponentTypes.ATTRIBUTE_MODIFIERS); - if (itemAttribute != null) - { - List modifiers = itemAttribute.modifiers(); + List modifiers = itemAttribute.modifiers(); - for (AttributeModifiersComponent.Entry entry : modifiers) + for (AttributeModifiersComponent.Entry entry : modifiers) + { + if (entry.attribute().equals(EntityAttributes.GENERIC_ATTACK_DAMAGE)) { - if (entry.attribute().equals(EntityAttributes.GENERIC_ATTACK_DAMAGE)) - { - if (item instanceof SwordItem) - { - return (float) entry.modifier().value(); - } - else if (item instanceof MiningToolItem) - { - return (float) entry.modifier().value(); - } - } + return (float) entry.modifier().value(); } - return 0F; } - else - return 0F; + return 0F; } else return 0F; @@ -1160,29 +1140,28 @@ public static void switchToPickedBlock() public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { + ContainerComponent itemContainer = stack.getComponents().get(DataComponentTypes.CONTAINER); boolean changed = false; - ComponentMap data = stack.getComponents(); + int count = 0; - if (data != null && data.contains(DataComponentTypes.CONTAINER)) + if (itemContainer != null) { - ContainerComponent itemContainer = data.get(DataComponentTypes.CONTAINER); + Iterator iter = itemContainer.streamNonEmpty().iterator(); - if (itemContainer != null) + while (iter.hasNext()) { - Iterator iter = itemContainer.stream().iterator(); - - while (iter.hasNext()) + ItemStack item = iter.next(); + if (item.isEmpty()) { - ItemStack item = iter.next(); - if (item.isEmpty()) - { - iter.remove(); - changed = true; - } + iter.remove(); + changed = true; } + count++; } } + Tweakeroo.debugLog("cleanUpShulkerBoxNBT(): count {} // changed: {}", count, changed); + return changed; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java index 8c31f6bee..a040b2a14 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java @@ -205,23 +205,23 @@ public static void resetMouseSensitivityForZoom() public static boolean isStrippableLog(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); - return IMixinAxeItem.tweakeroo$getStrippedBlocks().containsKey(state.getBlock()); + return IMixinAxeItem.tweakeroo_getStrippedBlocks().containsKey(state.getBlock()); } public static boolean isShovelPathConvertableBlock(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); - return IMixinShovelItem.tweakeroo$getPathStates().containsKey(state.getBlock()); + return IMixinShovelItem.tweakeroo_getPathStates().containsKey(state.getBlock()); } public static boolean getUpdateExec(CommandBlockBlockEntity te) { - return ((IMixinCommandBlockExecutor) te.getCommandExecutor()).tweakeroo$getUpdateLastExecution(); + return ((IMixinCommandBlockExecutor) te.getCommandExecutor()).getUpdateLastExecution(); } public static void setUpdateExec(CommandBlockBlockEntity te, boolean value) { - ((IMixinCommandBlockExecutor) te.getCommandExecutor()).tweakeroo$setUpdateLastExecution(value); + ((IMixinCommandBlockExecutor) te.getCommandExecutor()).setUpdateLastExecution(value); } public static void printDeathCoordinates(MinecraftClient mc) @@ -265,7 +265,7 @@ public static int getChatBackgroundColor(int colorOrig) public static void copyTextFromSign(SignBlockEntity te, boolean front) { - previousSignText = ((ISignTextAccess) te).tweakeroo$getText(front); + previousSignText = ((ISignTextAccess) te).getText(front); } public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable AbstractSignEditScreen guiLines, boolean front) @@ -275,7 +275,7 @@ public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable Abstrac te.setText(previousSignText, front); if (guiLines != null) { - ((IGuiEditSign) guiLines).tweakeroo$applyText(previousSignText); + ((IGuiEditSign) guiLines).applyText(previousSignText); } } } @@ -473,7 +473,7 @@ public static boolean writeAllMapsAsImages() return true; } - Map data = ((IMixinClientWorld) mc.world).tweakeroo$getMapStates(); + Map data = ((IMixinClientWorld) mc.world).tweakeroo_getMapStates(); String worldName = StringUtils.getWorldOrServerName(); if (worldName == null) From 546f14479e2e194e0d5642bcd7a5be22725ca69d Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:28:53 -0400 Subject: [PATCH 062/128] 1.20.5-pre.1 - code cleanups --- .../fi/dy/masa/tweakeroo/config/Callbacks.java | 1 - .../dy/masa/tweakeroo/mixin/MixinBlockItem.java | 13 ++++--------- .../masa/tweakeroo/mixin/MixinChatScreen.java | 9 +++------ .../mixin/MixinCommandBlockScreen.java | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinEntity.java | 10 +++++----- .../dy/masa/tweakeroo/mixin/MixinExplosion.java | 7 +++---- .../dy/masa/tweakeroo/mixin/MixinInGameHud.java | 3 ++- .../masa/tweakeroo/mixin/MixinItemEntity.java | 5 +++-- .../masa/tweakeroo/mixin/MixinLivingEntity.java | 17 ++++++----------- .../masa/tweakeroo/mixin/MixinPlayerEntity.java | 2 +- .../tweakeroo/mixin/MixinShulkerBoxBlock.java | 6 +++++- .../tweakeroo/mixin/MixinSignBlockEntity.java | 6 ++---- .../dy/masa/tweakeroo/renderer/RenderUtils.java | 4 +--- 13 files changed, 36 insertions(+), 49 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java index 734c90ab2..fc49169ed 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java @@ -183,7 +183,6 @@ private void applyValue(double gamma) { @SuppressWarnings("unchecked") IMixinSimpleOption opt = (IMixinSimpleOption) (Object) this.mc.options.getGamma(); - // Not sure why IntelliJ greys this out while it works? opt.tweakeroo_setValueWithoutCheck(gamma); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index 7d1fd7a05..356d89b9c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -70,16 +70,11 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx @Override public int getMaxStackSize(ItemStack stack) { - if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue()) + if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && + ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && + InventoryUtils.shulkerBoxHasItems(stack) == false) { - Block block = this.getBlock(); - if (block instanceof ShulkerBoxBlock) - { - if (InventoryUtils.shulkerBoxHasItems(stack) == false) - { - return 64; - } - } + return 64; } // FIXME How to call the stack-sensitive version on the super class? diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java index 0cbb81d5a..6fe575409 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatScreen.java @@ -35,7 +35,7 @@ private void storeChatText(CallbackInfo ci) @Inject(method = "(Ljava/lang/String;)V", at = @At("RETURN")) private void restoreText(String defaultText, CallbackInfo ci) { - if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && !MiscUtils.getLastChatText().isEmpty()) + if (FeatureToggle.TWEAK_CHAT_PERSISTENT_TEXT.getBooleanValue() && MiscUtils.getLastChatText().isEmpty() == false) { this.originalChatText = MiscUtils.getLastChatText(); } @@ -43,11 +43,8 @@ private void restoreText(String defaultText, CallbackInfo ci) @Inject(method = "keyPressed(III)Z", slice = @Slice( - from = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/screen/ChatScreen;sendMessage(Ljava/lang/String;Z)V")), - at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", - shift = Shift.AFTER)) + from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatScreen;sendMessage(Ljava/lang/String;Z)V")), + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = Shift.AFTER)) private void onSendMessage(int keyCode, int scancode, int modifiers, CallbackInfoReturnable cir) { MiscUtils.setLastChatText(""); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java index b3b96fa4a..5576e4870 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java @@ -101,7 +101,7 @@ private void addExtraFields(CallbackInfo ci) } } - // This is needed because otherwise, the name updating is delayed by "one GUI opening" >_> + // This is needed because otherwise the name updating is delayed by "one GUI opening" >_> @Override public void tick() { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index c4f7bf738..b7e14ffef 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -48,12 +48,12 @@ private void moreAccurateMoveRelative(float float_1, net.minecraft.util.math.Vec if (speed >= 1.0E-7D) { - motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); - double xFactor = Math.sin(this.yaw * Math.PI / 180D); - double zFactor = Math.cos(this.yaw * Math.PI / 180D); - net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); + motion = (speed > 1.0D ? motion.normalize() : motion).multiply((double) float_1); + double xFactor = Math.sin(this.yaw * Math.PI / 180D); + double zFactor = Math.cos(this.yaw * Math.PI / 180D); + net.minecraft.util.math.Vec3d change = new net.minecraft.util.math.Vec3d(motion.x * zFactor - motion.z * xFactor, motion.y, motion.z * zFactor + motion.x * xFactor); - this.setVelocity(this.getVelocity().add(change)); + this.setVelocity(this.getVelocity().add(change)); } ci.cancel(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java index 34053e88f..dd59a282f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinExplosion.java @@ -1,9 +1,9 @@ package fi.dy.masa.tweakeroo.mixin; -import net.minecraft.particle.ParticleEffect; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; +import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleTypes; import net.minecraft.world.explosion.Explosion; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -12,8 +12,8 @@ public abstract class MixinExplosion { @ModifyArg(method = "affectWorld", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V")) + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V")) private ParticleEffect addParticleModify(ParticleEffect parameters) { if (FeatureToggle.TWEAK_EXPLOSION_REDUCED_PARTICLES.getBooleanValue()) @@ -23,5 +23,4 @@ private ParticleEffect addParticleModify(ParticleEffect parameters) return ParticleTypes.EXPLOSION_EMITTER; } - } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index 602061db9..d290de596 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -64,7 +64,8 @@ private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, Ca } } - @Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true) + @Inject(method = "renderScoreboardSidebar(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/scoreboard/ScoreboardObjective;)V", + at = @At("HEAD"), cancellable = true) private void disableScoreboardRendering(CallbackInfo ci) { if (Configs.Disable.DISABLE_SCOREBOARD_RENDERING.getBooleanValue()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 5027a1782..704b9c956 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import net.minecraft.block.ShulkerBoxBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -13,6 +14,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.IEntityItem; import fi.dy.masa.tweakeroo.util.InventoryUtils; @@ -74,7 +76,6 @@ private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) @Inject(method = "tryMerge(Lnet/minecraft/entity/ItemEntity;)V", at = @At("HEAD"), cancellable = true) private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) { - // I don't know why IntelliJ greys this out while it is working well if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) { ItemEntity self = (ItemEntity) (Object) this; @@ -84,7 +85,7 @@ private void stackEmptyShulkerBoxes(ItemEntity other, CallbackInfo ci) if (stackSelf.getItem() instanceof BlockItem && ((BlockItem) stackSelf.getItem()).getBlock() instanceof ShulkerBoxBlock && stackSelf.getItem() == stackOther.getItem() && fi.dy.masa.malilib.util.InventoryUtils.shulkerBoxHasItems(stackSelf) == false && - // Only stack up to SHULKER_MAX_STACK_SIZE, and don't steal from other stacks that are larger + // Only stack up to 64, and don't steal from other stacks that are larger stackSelf.getCount() < 64 && stackSelf.getCount() >= stackOther.getCount() && ItemStack.areItemsAndComponentsEqual(stackSelf, stackOther)) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index b996a5a58..f8e3b7b8e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -28,9 +28,7 @@ private MixinLivingEntity(EntityType type, World worldIn) target = "Lnet/minecraft/world/World;isClient:Z")) private boolean fixElytraLanding(World world) { - return world.isClient && - (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || - ((Object) this instanceof ClientPlayerEntity) == false); + return world.isClient && (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || ((Object) this instanceof ClientPlayerEntity) == false); } @Inject(method = "tickStatusEffects", at = @At(value = "INVOKE", ordinal = 0, @@ -40,14 +38,11 @@ private void removeOwnPotionEffects(CallbackInfo ci) { MinecraftClient mc = MinecraftClient.getInstance(); - if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue()) + + if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue() && + ((Object) this) == mc.player && mc.options.getPerspective() == Perspective.FIRST_PERSON) { - // I don't know why IntelliJ is greying this out when it works fine. - if ((((Object) this) == (LivingEntity) mc.player) && - (mc.options.getPerspective() == Perspective.FIRST_PERSON)) - { - ci.cancel(); - } + ci.cancel(); } } @@ -56,7 +51,7 @@ private void removeOwnPotionEffects(CallbackInfo ci) private void tweakeroo_applyCustomDeceleration(CallbackInfo ci) { if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue() && - ((Entity) this) == MinecraftClient.getInstance().player) + ((Entity) this) == MinecraftClient.getInstance().player) { MiscUtils.handlePlayerDeceleration(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index f80e33e35..53a6d3ef7 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -40,7 +40,7 @@ private void restore_1_15_2_sneaking(CallbackInfoReturnable cir) target = "Lnet/minecraft/entity/player/PlayerEntity;clipAtLedge()Z", ordinal = 0)) private boolean fakeSneaking(PlayerEntity entity) { - if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && (Object) this instanceof ClientPlayerEntity) + if (FeatureToggle.TWEAK_FAKE_SNEAKING.getBooleanValue() && ((Object) this) instanceof ClientPlayerEntity) { return true; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index 177fae1f1..56d9962f0 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -16,7 +16,11 @@ public abstract class MixinShulkerBoxBlock { @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void removeVanillaTooltip(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipType options, CallbackInfo ci) + private void removeVanillaTooltip(ItemStack stack, + Item.TooltipContext context, + List tooltip, + TooltipType options, + CallbackInfo ci) { if (Configs.Disable.DISABLE_SHULKER_BOX_TOOLTIP.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index 255fd73e3..fe5c69445 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -1,23 +1,21 @@ package fi.dy.masa.tweakeroo.mixin; -import net.minecraft.client.gui.screen.ingame.HangingSignEditScreen; -import net.minecraft.registry.RegistryWrapper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.block.entity.SignText; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.HangingSignEditScreen; import net.minecraft.client.gui.screen.ingame.SignEditScreen; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.util.math.BlockPos; - import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.IGuiEditSign; import fi.dy.masa.tweakeroo.util.ISignTextAccess; diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 8bb7872c8..08afaeefa 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -274,12 +274,10 @@ public static float getLavaFogDistance(Entity entity, float originalFog) // With the Vanilla changes, the old values were very Overpowered. // (was: *1.6f, and *(resp * 1.6f)) -- getting values as high as 38.4f, // when we really only need around 15.0f at the most for full visibility. - // 5.0f w/ Fire Res (Max: 13.5f) - // 1.0f no Fire Res (Max: 7.2f) if (originalFog > 3.0f) { - fog += 2.3f; // Fire Res bonus +2.3f + fog += 3.3f; // Fire Res bonus } if (aqua > 0) { From 7a1f5c3f18c27059519506e85a8b79c766ad3b7f Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:37:13 -0400 Subject: [PATCH 063/128] 1.20.5-pre.1 - code cleanups --- .../fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java | 2 ++ src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 6 ++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java index 7ed44ef32..4bbdee519 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java @@ -60,7 +60,7 @@ public void tweakeroo_invokeDoItemUse() } @Inject(method = "render", at = @At("RETURN")) - private void tweakeroo$onGameLoop(boolean renderWorld, CallbackInfo ci) + private void onGameLoop(boolean renderWorld, CallbackInfo ci) { if (this.player != null && this.world != null) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index fe5c69445..9b0bee2d1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -5,6 +5,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; @@ -16,6 +17,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.registry.RegistryWrapper; import net.minecraft.util.math.BlockPos; + import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.IGuiEditSign; import fi.dy.masa.tweakeroo.util.ISignTextAccess; diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index d226cc013..27e0a02c6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -5,6 +5,7 @@ import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; + import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.component.DataComponentTypes; @@ -33,6 +34,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; + import fi.dy.masa.malilib.gui.Message; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; @@ -1142,7 +1144,6 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) { ContainerComponent itemContainer = stack.getComponents().get(DataComponentTypes.CONTAINER); boolean changed = false; - int count = 0; if (itemContainer != null) { @@ -1156,12 +1157,9 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) iter.remove(); changed = true; } - count++; } } - Tweakeroo.debugLog("cleanUpShulkerBoxNBT(): count {} // changed: {}", count, changed); - return changed; } } From 9d0504ce8c5d25a3f5e43b2701ca9579452bd897 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:41:18 -0400 Subject: [PATCH 064/128] 1.20.5-pre.1 - code cleanups --- src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index f8e3b7b8e..44ad756c9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -38,7 +38,6 @@ private void removeOwnPotionEffects(CallbackInfo ci) { MinecraftClient mc = MinecraftClient.getInstance(); - if (Configs.Disable.DISABLE_FP_EFFECT_PARTICLES.getBooleanValue() && ((Object) this) == mc.player && mc.options.getPerspective() == Perspective.FIRST_PERSON) { From 4ee285ec7d0afb6cb9884c5da51c350921d04750 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:33:42 -0400 Subject: [PATCH 065/128] 1.20.5-pre.2 support --- gradle.properties | 14 +++++++------- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9be1420dd..51d931212 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-beta.1 +mod_version = 0.20.0-beta.2 # Required malilib version -malilib_version = 0.19.0-beta.1 +malilib_version = 0.19.0-beta.2 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-pre1 -minecraft_version = 1.20.5-pre1 -mappings_version = 1.20.5-pre1+build.5 +minecraft_version_out = 1.20.5-pre2 +minecraft_version = 1.20.5-pre2 +mappings_version = 1.20.5-pre2+build.1 -fabric_loader_version = 0.15.9 +fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 -fabric_api_version = 0.96.15+1.20.5 +fabric_api_version = 0.97.1+1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 57759c3c9..73560419a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-beta.1", - "malilib": ">=0.19.0-beta.1" + "minecraft": ">=1.20.5-beta.2", + "malilib": ">=0.19.0-beta.2" }, "custom": { "modmenu": { From 780eccb2fcf1261a71145d8d6e3d4abbc9e6d527 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:12:37 -0400 Subject: [PATCH 066/128] 1.20.5-pre.3 support --- gradle.properties | 10 +++++----- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 51d931212..c81baee6f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-beta.2 +mod_version = 0.20.0-beta.3 # Required malilib version -malilib_version = 0.19.0-beta.2 +malilib_version = 0.19.0-beta.3 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-pre2 -minecraft_version = 1.20.5-pre2 -mappings_version = 1.20.5-pre2+build.1 +minecraft_version_out = 1.20.5-pre3 +minecraft_version = 1.20.5-pre3 +mappings_version = 1.20.5-pre3+build.1 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 73560419a..ad8946f4a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-beta.2", - "malilib": ">=0.19.0-beta.2" + "minecraft": ">=1.20.5-beta.3", + "malilib": ">=0.19.0-beta.3" }, "custom": { "modmenu": { From d1589bee40b718e2b60cbd6e3f899337b1a85a83 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:04:28 -0400 Subject: [PATCH 067/128] 1.20.5-pre.3 - Update lava visibility values to closer resemble the values under 1.20.4, with only a slight boost around maybe ~1.0-2.0f --- .../dy/masa/tweakeroo/renderer/RenderUtils.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 08afaeefa..88e67606f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -30,6 +30,7 @@ import fi.dy.masa.malilib.util.EntityUtils; import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.tweakeroo.Tweakeroo; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.tweakeroo.util.MiscUtils; @@ -269,26 +270,18 @@ public static float getLavaFogDistance(Entity entity, float originalFog) { final int resp = EnchantmentHelper.getRespiration(living); final int aqua = EnchantmentHelper.getEquipmentLevel(Enchantments.AQUA_AFFINITY, living); - float fog = originalFog; + float fog = (originalFog > 1.0f) ? 3.3f : 1.3f; - // With the Vanilla changes, the old values were very Overpowered. - // (was: *1.6f, and *(resp * 1.6f)) -- getting values as high as 38.4f, - // when we really only need around 15.0f at the most for full visibility. - - if (originalFog > 3.0f) - { - fog += 3.3f; // Fire Res bonus - } if (aqua > 0) { - fog += 1.7f; + fog *= 1.6f; } if (resp > 0) { - fog += (float) resp * 1.5f; + fog *= (float) resp * 1.6f; } - //Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {} originalFog: {}", aqua, resp, fog, originalFog); + Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {}, originalFog: {}", aqua, resp, fog, originalFog); return Math.max(fog, originalFog); } From 1b5fb32908f4971bb07197b9e13cb256c403f3b2 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:04:28 -0400 Subject: [PATCH 068/128] 1.20.5-pre.3 - Update lava visibility values to closer resemble the values under 1.20.4, with only a slight boost around maybe ~1.0-2.0f --- .../dy/masa/tweakeroo/renderer/RenderUtils.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 08afaeefa..7b6e66713 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -30,6 +30,7 @@ import fi.dy.masa.malilib.util.EntityUtils; import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.tweakeroo.Tweakeroo; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.tweakeroo.util.MiscUtils; @@ -269,26 +270,18 @@ public static float getLavaFogDistance(Entity entity, float originalFog) { final int resp = EnchantmentHelper.getRespiration(living); final int aqua = EnchantmentHelper.getEquipmentLevel(Enchantments.AQUA_AFFINITY, living); - float fog = originalFog; + float fog = (originalFog > 1.0f) ? 3.3f : 1.3f; - // With the Vanilla changes, the old values were very Overpowered. - // (was: *1.6f, and *(resp * 1.6f)) -- getting values as high as 38.4f, - // when we really only need around 15.0f at the most for full visibility. - - if (originalFog > 3.0f) - { - fog += 3.3f; // Fire Res bonus - } if (aqua > 0) { - fog += 1.7f; + fog *= 1.6f; } if (resp > 0) { - fog += (float) resp * 1.5f; + fog *= (float) resp * 1.6f; } - //Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {} originalFog: {}", aqua, resp, fog, originalFog); + //Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {}, originalFog: {}", aqua, resp, fog, originalFog); return Math.max(fog, originalFog); } From 4da86ccbec57ee6cf79228ccf4a51107be1146b6 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 17 Apr 2024 23:49:54 -0400 Subject: [PATCH 069/128] 1.20.5-pre.4 support --- gradle.properties | 12 ++++++------ src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c81baee6f..f345d525d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-beta.3 +mod_version = 0.20.0-beta.4 # Required malilib version -malilib_version = 0.19.0-beta.3 +malilib_version = 0.19.0-beta.4 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-pre3 -minecraft_version = 1.20.5-pre3 -mappings_version = 1.20.5-pre3+build.1 +minecraft_version_out = 1.20.5-pre4 +minecraft_version = 1.20.5-pre4 +mappings_version = 1.20.5-pre4+build.1 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 -fabric_api_version = 0.97.1+1.20.5 +fabric_api_version = 0.97.3+1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ad8946f4a..73b9f46f8 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-beta.3", - "malilib": ">=0.19.0-beta.3" + "minecraft": ">=1.20.5-beta.4", + "malilib": ">=0.19.0-beta.4" }, "custom": { "modmenu": { From d9c96dfb78cfd52ea7fb128ca9e91911e50d7b51 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 18 Apr 2024 12:04:55 -0400 Subject: [PATCH 070/128] 1.20.5-rc1 support --- gradle.properties | 10 +++++----- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index f345d525d..83a021df7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-beta.4 +mod_version = 0.20.0-rc1 # Required malilib version -malilib_version = 0.19.0-beta.4 +malilib_version = 0.19.0-rc1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-pre4 -minecraft_version = 1.20.5-pre4 -mappings_version = 1.20.5-pre4+build.1 +minecraft_version_out = 1.20.5-rc1 +minecraft_version = 1.20.5-rc1 +mappings_version = 1.20.5-rc1+build.1 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 73b9f46f8..0e83a4fd1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-beta.4", - "malilib": ">=0.19.0-beta.4" + "minecraft": ">=1.20.5-rc.1", + "malilib": ">=0.19.0-rc1" }, "custom": { "modmenu": { From 7945e7a3efcc1048c66ee88c0ed824681361a7a4 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 18 Apr 2024 20:43:44 -0400 Subject: [PATCH 071/128] 1.20.5-rc1 - code cleanups --- gradle.properties | 2 +- .../java/fi/dy/masa/tweakeroo/Tweakeroo.java | 8 - .../fi/dy/masa/tweakeroo/config/Configs.java | 5 +- .../mixin/MixinBackgroundRenderer.java | 29 ++++ .../tweakeroo/mixin/MixinPlayerEntity.java | 11 +- .../masa/tweakeroo/renderer/RenderUtils.java | 3 +- .../tweakeroo/tweaks/PlacementTweaks.java | 5 - .../masa/tweakeroo/util/InventoryUtils.java | 40 +---- src/main/resources/mixins.tweakeroo.json | 161 +++++++++--------- 9 files changed, 126 insertions(+), 138 deletions(-) diff --git a/gradle.properties b/gradle.properties index 83a021df7..5ac0ef742 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.19.0-rc1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5-rc1 minecraft_version = 1.20.5-rc1 -mappings_version = 1.20.5-rc1+build.1 +mappings_version = 1.20.5-rc1+build.2 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java index bc8616c77..ea590e944 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java +++ b/src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java @@ -4,7 +4,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import fi.dy.masa.malilib.event.InitializationHandler; -import fi.dy.masa.tweakeroo.config.Configs; public class Tweakeroo implements ModInitializer { @@ -18,11 +17,4 @@ public void onInitialize() { InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); } - public static void debugLog(String msg, Object... args) - { - if (Configs.Generic.DEBUG_LOGGING.getBooleanValue()) - { - Tweakeroo.logger.info(msg, args); - } - } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 64cab5811..27d8d2b3e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -47,7 +47,7 @@ public static class Generic public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)"); public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod"); public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); - public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); + //public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); @@ -117,7 +117,7 @@ public static class Generic public static final ImmutableList OPTIONS = ImmutableList.of( CARPET_ACCURATE_PLACEMENT_PROTOCOL, CLIENT_PLACEMENT_ROTATION, - DEBUG_LOGGING, + //DEBUG_LOGGING, FAST_LEFT_CLICK_ALLOW_TOOLS, FAST_PLACEMENT_REMEMBER_ALWAYS, FREE_CAMERA_PLAYER_INPUTS, @@ -466,7 +466,6 @@ public static void loadFromFile() // Turn off after loading the configs, just in case it was enabled in the config somehow. // But only if we are currently not in a world, since changing configs also re-loads them when closing the menu. FeatureToggle.TWEAK_FREE_CAMERA.setBooleanValue(false); - FeatureToggle.TWEAK_GAMMA_OVERRIDE.setBooleanValue(false); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 222d530cb..8216ee771 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -55,6 +55,35 @@ private static float reduceLavaFogEnd(float original) return original; } + /* + @ModifyVariable( + method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", + slice = @Slice( + from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), + at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 2), ordinal = 1) + private static float overrideFogStart(float original) + { + if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) + { + return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 1.6f; + } + return original; + } + @ModifyVariable( + method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", + slice = @Slice( + from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), + at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 3), ordinal = 2) + private static float overrideFogEnd(float original) + { + if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) + { + return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 2.0f; + } + return original; + } + */ + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld$Properties;getHorizonShadingRatio()F")) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 53a6d3ef7..f295e6bdd 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -1,6 +1,5 @@ package fi.dy.masa.tweakeroo.mixin; -import net.minecraft.server.MinecraftServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -51,10 +50,9 @@ private boolean fakeSneaking(PlayerEntity entity) @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) private void overrideBlockReachDistance(CallbackInfoReturnable cir) { - MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - if (server != null) + if (this.getServer() != null) { cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } @@ -62,7 +60,7 @@ private void overrideBlockReachDistance(CallbackInfoReturnable cir) { double rangeRealMax = cir.getReturnValue() + 1.0; - // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. + // Calculate a "safe" range for servers. This only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } } @@ -71,10 +69,9 @@ private void overrideBlockReachDistance(CallbackInfoReturnable cir) @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) private void overrideEntityReachDistance(CallbackInfoReturnable cir) { - MinecraftServer server = this.getServer(); if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - if (server != null) + if (this.getServer() != null) { cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } @@ -82,7 +79,7 @@ private void overrideEntityReachDistance(CallbackInfoReturnable cir) { double rangeRealMax = cir.getReturnValue() + 1.0; - // Calculate a "safe" range for servers. It only allows for an extra 1.0 of Interaction range. + // Calculate a "safe" range for servers. This only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 7b6e66713..e880a00bf 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -30,7 +30,6 @@ import fi.dy.masa.malilib.util.EntityUtils; import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.tweakeroo.Tweakeroo; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.tweakeroo.util.MiscUtils; @@ -276,12 +275,12 @@ public static float getLavaFogDistance(Entity entity, float originalFog) { fog *= 1.6f; } + if (resp > 0) { fog *= (float) resp * 1.6f; } - //Tweakeroo.debugLog("getLavaFogDistance(): aqua: {} resp: {} // fog: {}, originalFog: {}", aqua, resp, fog, originalFog); return Math.max(fog, originalFog); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index bc76cd1f5..b29fa9787 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -250,7 +250,6 @@ private static void onUsingTick() hitResult = new BlockHitResult(hitVec, side, posNew, false); ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hitResult)); - //Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, side {} pos {} hitResult {}, posNew {}, posLast {}", side, pos, hitResult, posNew, posLast); if (hand != null && posNew.equals(posLast) == false && canPlaceBlockIntoPosition(world, posNew, ctx) && @@ -274,8 +273,6 @@ private static void onUsingTick() ActionResult result = tryPlaceBlock(mc.interactionManager, player, mc.world, posNew, sideFirst, sideRotatedFirst, playerYawFirst, hitVec, hand, hitPartFirst, false); - //Tweakeroo.debugLog("onUsingTick(): fastBlockPlacement, tryPlaceBlock: hitVec {} result {}", hitVec, result); - if (result == ActionResult.SUCCESS) { posLast = posNew; @@ -301,8 +298,6 @@ else if (FeatureToggle.TWEAK_FAST_RIGHT_CLICK.getBooleanValue() && { final int count = Configs.Generic.FAST_RIGHT_CLICK_COUNT.getIntegerValue(); - //Tweakeroo.debugLog("onUsingTick(): fastRightClick, count {} ", count); - for (int i = 0; i < count; ++i) { isEmulatedClick = true; diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 27e0a02c6..97d0eb5d9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -297,7 +297,6 @@ public static void swapHotbarWithInventoryRow(PlayerEntity player, int row) for (int hotbarSlot = 0; hotbarSlot < 9; hotbarSlot++) { - //Tweakeroo.debugLog("swapHotbarWithInventoryRow(): slot {}, hotbarSlot {} --> malilib.InventoryUtils.swapSlots()", slot, hotbarSlot); fi.dy.masa.malilib.util.InventoryUtils.swapSlots(container, slot, hotbarSlot); slot++; } @@ -319,7 +318,6 @@ public static void restockNewStackToHand(PlayerEntity player, Hand hand, ItemSta if (slotWithItem != -1) { - //Tweakeroo.debugLog("restockNewStackToHand(): hand {}, slotWithItem {}", hand.name(), slotWithItem); swapItemToHand(player, hand, slotWithItem); } } @@ -359,7 +357,6 @@ public static void preRestockHand(PlayerEntity player, Hand hand, boolean allowH // stack in hand, then left click, otherwise right click to split the stack int button = stackSlot.getCount() + stackHand.getCount() <= stackHand.getMaxCount() ? 0 : 1; - //Tweakeroo.debugLog("preRestockHand(): syncId {}, slot id {}, button {} // pickup --> currentSlot {}", container.syncId, slot.id, button, currentSlot); mc.interactionManager.clickSlot(container.syncId, slot.id, button, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, currentSlot, 0, SlotActionType.PICKUP, player); @@ -459,10 +456,9 @@ private static float getBaseAttackDamage(ItemStack stack) return (float) entry.modifier().value(); } } - return 0F; } - else - return 0F; + + return 0F; } protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) @@ -701,7 +697,6 @@ private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type if (slotRepairableItem != -1) { - //Tweakeroo.debugLog("repairModeHandleSlot(): type {} // slotRepairableItem {}", type.asString(), slotRepairableItem); swapItemToEquipmentSlot(player, type, slotRepairableItem); InfoUtils.printActionbarMessage("tweakeroo.message.repair_mode.swapped_repairable_item_to_slot", type.getName()); } @@ -750,7 +745,6 @@ public static void swapElytraWithChestPlate(@Nullable PlayerEntity player) if (targetSlot >= 0) { //targetSlots.sort(); - //Tweakeroo.debugLog("swapElytraWithChestPlate(): chest, target slot {}", targetSlot); swapItemToEquipmentSlot(player, EquipmentSlot.CHEST, targetSlot); } } @@ -810,18 +804,15 @@ private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumbe if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; - //Tweakeroo.debugLog("swapItemToHand(): slotNumber: {}, inv.selectedSlot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else { - //Tweakeroo.debugLog("swapItemToHand(): clickSlot 1, slotNumber: {}, currentHotbarSlot {}", slotNumber, currentHotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player); } } else if (hand == Hand.OFF_HAND) { - //Tweakeroo.debugLog("swapItemToHand(): clickSlot 2, slotNumber: {} (button 40)", slotNumber); mc.interactionManager.clickSlot(container.syncId, slotNumber, 40, SlotActionType.SWAP, mc.player); } } @@ -831,21 +822,13 @@ private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot t { if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) { + MinecraftClient mc = MinecraftClient.getInstance(); + ScreenHandler container = player.playerScreenHandler; int equipmentSlotNumber = getSlotNumberForEquipmentType(type, player); - swapSlots(player, sourceSlotNumber, equipmentSlotNumber); - } - } + int equipmentSlotInvIndex = container.getSlot(equipmentSlotNumber).getIndex(); - public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) - { - MinecraftClient mc = MinecraftClient.getInstance(); - ScreenHandler container = player.currentScreenHandler; - //Tweakeroo.debugLog("swapSlots(): click slot 1, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); - mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); - //Tweakeroo.debugLog("swapSlots(): click slot 2, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); - mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); - //Tweakeroo.debugLog("swapSlots(): click slot 3, slotNum: {}, otherSlot {}, SlotNum {} (button 0)", slotNum, otherSlot, slotNum); - mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, SlotActionType.SWAP, mc.player); + } } private static void swapToolToHand(int slotNumber, MinecraftClient mc) @@ -860,7 +843,6 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (isHotbarSlot(slotNumber)) { inventory.selectedSlot = slotNumber - 36; - //Tweakeroo.debugLog("swapToolToHand() slotnumber: {}, inv.selected slot: {} --> Yeet packet", slotNumber, inventory.selectedSlot); mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } else @@ -873,11 +855,9 @@ private static void swapToolToHand(int slotNumber, MinecraftClient mc) if (hotbarSlot != selectedSlot) { inventory.selectedSlot = hotbarSlot; - //Tweakeroo.debugLog("swapToolToHand() hotbarSlot: {} (vs selectedSlot {}), inv.selected slot: {} --> Yeet packet", hotbarSlot, selectedSlot, inventory.selectedSlot); mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(inventory.selectedSlot)); } - //Tweakeroo.debugLog("swapToolToHand(): clickSlot --> slotNumber {}, hotbarSlot {}", slotNumber, hotbarSlot); mc.interactionManager.clickSlot(container.syncId, slotNumber, hotbarSlot, SlotActionType.SWAP, mc.player); } } @@ -1039,14 +1019,12 @@ private static void tryCombineStacksInInventory(PlayerEntity player, ItemStack s if (stack.getCount() < stack.getMaxCount()) { // Pick up the item from slot1 and try to put it in slot2 - //Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 1 --> slot1.id {}, slot2.id {}, (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); mc.interactionManager.clickSlot(container.syncId, slot2.id, 0, SlotActionType.PICKUP, player); // If the items didn't all fit, return the rest if (player.getInventory().getMainHandStack().isEmpty() == false) { - //Tweakeroo.debugLog("tryCombineStacksInInventory(): clickSlot 2 --> slot1.id {} (button 0)",slot1.id, slot2.id); mc.interactionManager.clickSlot(container.syncId, slot1.id, 0, SlotActionType.PICKUP, player); } @@ -1123,7 +1101,6 @@ public static void switchToPickedBlock() if (isCreative) { inventory.addPickBlock(stack); - //Tweakeroo.debugLog("switchToPickedBlock(): clickCreativeStack --> inv.selectedSlot {}", inventory.selectedSlot); mc.interactionManager.clickCreativeStack(player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot); } else @@ -1147,11 +1124,12 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) if (itemContainer != null) { - Iterator iter = itemContainer.streamNonEmpty().iterator(); + Iterator iter = itemContainer.stream().iterator(); while (iter.hasNext()) { ItemStack item = iter.next(); + if (item.isEmpty()) { iter.remove(); diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index 4b00d438b..a462c962b 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -1,83 +1,82 @@ { - "required": true, - "package": "fi.dy.masa.tweakeroo.mixin", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_17", - "client": [ - "IMixinAbstractBlock", - "IMixinAbstractHorseEntity", - "IMixinAxeItem", - "IMixinChunkLightProvider", - "IMixinClientWorld", - "IMixinCommandBlockExecutor", - "IMixinShovelItem", - "IMixinSimpleOption", - "MixinAbstractClientPlayerEntity", - "MixinAbstractInventoryScreen", - "MixinAbstractSignEditScreen", - "MixinBackgroundRenderer", - "MixinBatEntity", - "MixinBeaconBlockEntityRenderer", - "MixinBlockEntityRenderDispatcher", - "MixinBlockItem", - "MixinBossBarHud", - "MixinBuiltChunk", - "MixinChatHud", - "MixinChatScreen", - "MixinChunkBuilder_BuiltChunk", - "MixinClientBossBar", - "MixinClientCommandSource", - "MixinClientPlayerEntity", - "MixinClientPlayerInteractionManager", - "MixinClientPlayNetworkHandler", - "MixinClientWorld", - "MixinClientWorld_Properties", - "MixinCloneCommand", - "MixinCommandBlockScreen", - "MixinCreativeInventoryScreen", - "MixinDimensionEffects_Nether", - "MixinEntity", - "MixinEntityRenderDispatcher", - "MixinExplosion", - "MixinFillCommand", - "MixinGameRenderer", - "MixinHeldItemRenderer", - "MixinInGameHud", - "MixinItem", - "MixinItemEntity", - "MixinItemGroup", - "MixinItemStack", - "MixinKeyboardInput", - "MixinLightingProvider", - "MixinLivingEntity", - "MixinMinecraftClient", - "MixinMobSpawnerBlockEntityRenderer", - "MixinMobSpawnerLogic", - "MixinMouse", - "MixinNetherPortalBlock", - "MixinObserverBlock", - "MixinParticleManager", - "MixinPlayerAbilities", - "MixinPlayerEntity", - "MixinRavagerEntity", - "MixinScaffoldingBlock", - "MixinSculkSensor", - "MixinServerPlayNetworkHandler", - "MixinShulkerBoxBlock", - "MixinSignBlockEntity", - "MixinSlimeBlock", - "MixinStructureBlockBlockEntity", - "MixinTeleportSpectatorMenu", - "MixinThreadedAnvilChunkStorage", - "MixinTradeOffer", - "MixinUpdateStructureBlockC2SPacket", - "MixinWindow", - "MixinWorld", - "MixinWorldRenderer" - ], - "mixinPriority": 990, - "injectors": { - "defaultRequire": 0 - }, - "mixins": [] + "required": true, + "package": "fi.dy.masa.tweakeroo.mixin", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_17", + "client": [ + "IMixinAbstractBlock", + "IMixinAbstractHorseEntity", + "IMixinAxeItem", + "IMixinChunkLightProvider", + "IMixinClientWorld", + "IMixinCommandBlockExecutor", + "IMixinShovelItem", + "IMixinSimpleOption", + "MixinAbstractClientPlayerEntity", + "MixinAbstractInventoryScreen", + "MixinAbstractSignEditScreen", + "MixinBackgroundRenderer", + "MixinBatEntity", + "MixinBeaconBlockEntityRenderer", + "MixinBlockEntityRenderDispatcher", + "MixinBlockItem", + "MixinBossBarHud", + "MixinBuiltChunk", + "MixinChatHud", + "MixinChatScreen", + "MixinChunkBuilder_BuiltChunk", + "MixinClientBossBar", + "MixinClientCommandSource", + "MixinClientPlayerEntity", + "MixinClientPlayerInteractionManager", + "MixinClientPlayNetworkHandler", + "MixinClientWorld", + "MixinClientWorld_Properties", + "MixinCloneCommand", + "MixinCommandBlockScreen", + "MixinCreativeInventoryScreen", + "MixinDimensionEffects_Nether", + "MixinEntity", + "MixinEntityRenderDispatcher", + "MixinExplosion", + "MixinFillCommand", + "MixinGameRenderer", + "MixinHeldItemRenderer", + "MixinInGameHud", + "MixinItem", + "MixinItemEntity", + "MixinItemGroup", + "MixinItemStack", + "MixinKeyboardInput", + "MixinLightingProvider", + "MixinLivingEntity", + "MixinMinecraftClient", + "MixinMobSpawnerBlockEntityRenderer", + "MixinMobSpawnerLogic", + "MixinMouse", + "MixinNetherPortalBlock", + "MixinObserverBlock", + "MixinParticleManager", + "MixinPlayerAbilities", + "MixinPlayerEntity", + "MixinRavagerEntity", + "MixinScaffoldingBlock", + "MixinSculkSensor", + "MixinServerPlayNetworkHandler", + "MixinShulkerBoxBlock", + "MixinSignBlockEntity", + "MixinSlimeBlock", + "MixinStructureBlockBlockEntity", + "MixinTeleportSpectatorMenu", + "MixinThreadedAnvilChunkStorage", + "MixinTradeOffer", + "MixinUpdateStructureBlockC2SPacket", + "MixinWindow", + "MixinWorld", + "MixinWorldRenderer" + ], + "mixinPriority": 990, + "injectors": { + "defaultRequire": 0 + } } From 025fd21dec94ad13791991ca7634d3146cd9b688 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 18 Apr 2024 21:04:26 -0400 Subject: [PATCH 072/128] 1.20.5-rc1 - reach distance fix --- .../java/fi/dy/masa/tweakeroo/config/Configs.java | 4 ++-- .../masa/tweakeroo/mixin/MixinPlayerEntity.java | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 27d8d2b3e..528c95f6f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -38,7 +38,7 @@ public static class Generic { public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled"); public static final ConfigDouble ANGEL_BLOCK_PLACEMENT_DISTANCE = new ConfigDouble ("angelBlockPlacementDistance", 3, 1, 5, "The distance from the player blocks can be placed in\nthe air when tweakAngelBlock is enabled.\n5 is the maximum the server allows."); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 0, 64, "The block reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 1, 64, "The block reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Block Type Break Restriction feature prevents breaking a block"); public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "The grid interval size for the grid breaking mode.\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."); public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)"); @@ -49,7 +49,7 @@ public static class Generic public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled."); //public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes."); public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "Whether or not to render the real pitch angle\nindicator when the elytra camera mode is active"); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 0, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 1, 64, "The entity reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server."); public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "Selects which type of warning message to show (if any)\nwhen the Entity Type Attack Restriction feature prevents attacking an entity"); public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "The maximum number of blocks to place per game tick\nwith the Fast Block Placement tweak"); public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "Allow the Fast Left Click to work in survival\nalso while holding tool items"); diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index f295e6bdd..2e37bf237 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -13,6 +13,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; +import fi.dy.masa.malilib.network.NetworkReference; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -47,39 +48,37 @@ private boolean fakeSneaking(PlayerEntity entity) return this.clipAtLedge(); } - @Inject(method = "getBlockInteractionRange", at = @At("HEAD"), cancellable = true) + @Inject(method = "getBlockInteractionRange", at = @At("RETURN"), cancellable = true) private void overrideBlockReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - if (this.getServer() != null) + if (NetworkReference.getInstance().isIntegrated()) { cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } else { + // Calculate a "safe" range for servers. This only allows for +1.0 of the actual Interaction range. double rangeRealMax = cir.getReturnValue() + 1.0; - - // Calculate a "safe" range for servers. This only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } } } - @Inject(method = "getEntityInteractionRange", at = @At("HEAD"), cancellable = true) + @Inject(method = "getEntityInteractionRange", at = @At("RETURN"), cancellable = true) private void overrideEntityReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - if (this.getServer() != null) + if (NetworkReference.getInstance().isIntegrated()) { cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } else { + // Calculate a "safe" range for servers. This only allows for +1.0 of the actual Interaction range. double rangeRealMax = cir.getReturnValue() + 1.0; - - // Calculate a "safe" range for servers. This only allows for an extra 1.0 of Interaction range. cir.setReturnValue(Math.min(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } } From f97d2889a2b644a898e848818499cd9807af0534 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 18 Apr 2024 21:06:26 -0400 Subject: [PATCH 073/128] 1.20.5-rc1 - reach distance fix --- .../java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 2e37bf237..1a881486c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -59,7 +59,7 @@ private void overrideBlockReachDistance(CallbackInfoReturnable cir) } else { - // Calculate a "safe" range for servers. This only allows for +1.0 of the actual Interaction range. + // Calculate a "safe" range for servers double rangeRealMax = cir.getReturnValue() + 1.0; cir.setReturnValue(Math.min(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } @@ -77,7 +77,7 @@ private void overrideEntityReachDistance(CallbackInfoReturnable cir) } else { - // Calculate a "safe" range for servers. This only allows for +1.0 of the actual Interaction range. + // Calculate a "safe" range for servers double rangeRealMax = cir.getReturnValue() + 1.0; cir.setReturnValue(Math.min(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue(), rangeRealMax)); } From 62f75b290f3fa72289dc1fed999463d0bc764844 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 20 Apr 2024 16:08:42 -0400 Subject: [PATCH 074/128] remove Network Reference call --- gradle.properties | 10 +++++----- .../fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java | 6 +++--- src/main/resources/fabric.mod.json | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5ac0ef742..1bf4811a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-rc1 +mod_version = 0.20.0-rc2 # Required malilib version -malilib_version = 0.19.0-rc1 +malilib_version = 0.19.0-rc2 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-rc1 -minecraft_version = 1.20.5-rc1 -mappings_version = 1.20.5-rc1+build.2 +minecraft_version_out = 1.20.5-rc2 +minecraft_version = 1.20.5-rc2 +mappings_version = 1.20.5-rc2+build.1 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java index 1a881486c..41e8b8c6e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPlayerEntity.java @@ -7,13 +7,13 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; -import fi.dy.masa.malilib.network.NetworkReference; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -53,7 +53,7 @@ private void overrideBlockReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_BLOCK_REACH_OVERRIDE.getBooleanValue()) { - if (NetworkReference.getInstance().isIntegrated()) + if (MinecraftClient.getInstance().isIntegratedServerRunning()) { cir.setReturnValue(Configs.Generic.BLOCK_REACH_DISTANCE.getDoubleValue()); } @@ -71,7 +71,7 @@ private void overrideEntityReachDistance(CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_ENTITY_REACH_OVERRIDE.getBooleanValue()) { - if (NetworkReference.getInstance().isIntegrated()) + if (MinecraftClient.getInstance().isIntegratedServerRunning()) { cir.setReturnValue(Configs.Generic.ENTITY_REACH_DISTANCE.getDoubleValue()); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0e83a4fd1..7268d5c81 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-rc.1", - "malilib": ">=0.19.0-rc1" + "minecraft": ">=1.20.5-rc.2", + "malilib": ">=0.19.0-rc2" }, "custom": { "modmenu": { From 3f867b7c45e54f11f75fce6b10e8dcb56b74a5b0 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 20 Apr 2024 20:26:37 -0400 Subject: [PATCH 075/128] Fix code --- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 97d0eb5d9..e9526376f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -822,15 +822,20 @@ private static void swapItemToEquipmentSlot(PlayerEntity player, EquipmentSlot t { if (sourceSlotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) { - MinecraftClient mc = MinecraftClient.getInstance(); - ScreenHandler container = player.playerScreenHandler; int equipmentSlotNumber = getSlotNumberForEquipmentType(type, player); - int equipmentSlotInvIndex = container.getSlot(equipmentSlotNumber).getIndex(); - - mc.interactionManager.clickSlot(container.syncId, sourceSlotNumber, equipmentSlotInvIndex, SlotActionType.SWAP, mc.player); + swapSlots(player, sourceSlotNumber, equipmentSlotNumber); } } + public static void swapSlots(PlayerEntity player, int slotNum, int otherSlot) + { + MinecraftClient mc = MinecraftClient.getInstance(); + ScreenHandler container = player.currentScreenHandler; + mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + mc.interactionManager.clickSlot(container.syncId, otherSlot, 0, SlotActionType.SWAP, player); + mc.interactionManager.clickSlot(container.syncId, slotNum, 0, SlotActionType.SWAP, player); + } + private static void swapToolToHand(int slotNumber, MinecraftClient mc) { PlayerEntity player = mc.player; From 5c2ad953f9091a3657faae0f561a47e8ac84151f Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 22 Apr 2024 22:19:59 -0400 Subject: [PATCH 076/128] 1.20.5-rc.3 --- gradle.properties | 12 ++++++------ src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1bf4811a7..8a0aa64bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-rc2 +mod_version = 0.20.0-rc3 # Required malilib version -malilib_version = 0.19.0-rc2 +malilib_version = 0.19.0-rc3 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-rc2 -minecraft_version = 1.20.5-rc2 -mappings_version = 1.20.5-rc2+build.1 +minecraft_version_out = 1.20.5-rc3 +minecraft_version = 1.20.5-rc3 +mappings_version = 1.20.5-rc3+build.2 fabric_loader_version = 0.15.10 mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 -fabric_api_version = 0.97.3+1.20.5 +fabric_api_version = 0.97.5+1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7268d5c81..148bd0b16 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-rc.2", - "malilib": ">=0.19.0-rc2" + "minecraft": ">=1.20.5-rc.3", + "malilib": ">=0.19.0-rc3" }, "custom": { "modmenu": { From b9a321d4e5ecbe5e8c2cf120ac582347228cff41 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Mon, 22 Apr 2024 22:38:14 -0400 Subject: [PATCH 077/128] code cleanups --- .../tweakeroo/tweaks/PlacementTweaks.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index b29fa9787..2b4633b94 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -132,7 +132,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) { if (isEmulatedClick == false) { - //Tweakeroo.debugLog("onProcessRightClickPre storing stack: {}", stackOriginal); + //System.out.printf("onProcessRightClickPre storing stack: %s\n", stackOriginal); cacheStackInHand(hand); } @@ -147,7 +147,7 @@ public static boolean onProcessRightClickPre(PlayerEntity player, Hand hand) public static void onProcessRightClickPost(PlayerEntity player, Hand hand) { - //Tweakeroo.debugLog("onProcessRightClickPost -> tryRestockHand with: {}, current: {}", stackBeforeUse[hand.ordinal()], player.getStackInHand(hand)); + //System.out.printf("onProcessRightClickPost -> tryRestockHand with: %s, current: %s\n", stackBeforeUse[hand.ordinal()], player.getHeldItem(hand)); tryRestockHand(player, hand, stackBeforeUse[hand.ordinal()]); } @@ -361,7 +361,7 @@ public static ActionResult onProcessRightClickBlock( return ActionResult.PASS; } - //Tweakeroo.debugLog("onProcessRightClickBlock() pos: {}, side: {}, part: {}, hitVec: {}", posIn, sideIn, hitPart, hitVec); + //System.out.printf("onProcessRightClickBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posIn, sideIn, hitPart, hitVec); ActionResult result = tryPlaceBlock(controller, player, world, posIn, sideIn, sideRotated, yaw, hitVec, hand, hitPart, true); // Store the initial click data for the fast placement mode @@ -387,7 +387,7 @@ public static ActionResult onProcessRightClickBlock( sideRotatedFirst = sideRotated; playerYawFirst = yaw; stackBeforeUse[hand.ordinal()] = stackPre; - //Tweakeroo.debugLog("plop store @ {}", posFirst); + //System.out.printf("plop store @ %s\n", posFirst); } return result; @@ -501,7 +501,7 @@ private static ActionResult tryPlaceBlock( { facing = facing.getOpposite(); } - //Tweakeroo.debugLog("PlacementTweaks#accurate - IN - facing: {}", facing); + //System.out.printf("accurate - IN - facing: %s\n", facing); } else if (flexible == false || rotation == false) { @@ -526,7 +526,7 @@ else if (flexible == false || rotation == false) } Direction facingTmp = BlockUtils.getFirstPropertyFacingValue(state); - //Tweakeroo.debugLog("PlacementTweaks#accurate - sideIn: {}, state: {}, hit: {}, posIn: {}, posNew: {}", sideIn, state, hitVec, posIn, posNew); + //System.out.printf("accurate - sideIn: %s, state: %s, hit: %s, f: %s, posNew: %s\n", sideIn, state, hitVec, EnumFacing.getDirectionFromEntityLiving(posIn, player), posNew); if (facingTmp != null) { @@ -541,8 +541,8 @@ else if (flexible == false || rotation == false) if (accurateReverse) { - //Tweakeroo.debugLog("PlacementTweaks#accurate - REVERSE - facingOrig: {}, facingNew: {}", facing, facing.getOpposite()); - if (accurateIn || !flexible || !rotation) + //System.out.printf("accurate - REVERSE - facingOrig: %s, facingNew: %s\n", facing, facing.getOpposite()); + if (accurateIn || flexible == false || rotation == false) { facing = facing.getOpposite(); } @@ -568,13 +568,13 @@ else if (flexible == false || rotation == false) x += afterClickerClickCount * 16; } - //Tweakeroo.debugLog("PlacementTweaks#accurate - pre hitVec: {}", hitVec); - //Tweakeroo.debugLog("PlacementTweaks#processRightClickBlockWrapper facing: {}, x: {}, posNew: {}, side: {}", facing, x, posNew, side); + //System.out.printf("accurate - pre hitVec: %s\n", hitVec); + //System.out.printf("processRightClickBlockWrapper facing: %s, x: %.3f, pos: %s, side: %s\n", facing, x, pos, side); hitVec = new Vec3d(x, hitVec.y, hitVec.z); - //Tweakeroo.debugLog("PlacementTweaks#accurate - post hitVec: {}", hitVec); + //System.out.printf("accurate - post hitVec: %s\n", hitVec); } - //Tweakeroo.debugLog("PlacementTweaks#accurate - facing: {}, side: {}, posNew: {}, hit: {}", facing, side, posNew, hitVec); + //System.out.printf("accurate - facing: %s, side: %s, posNew: %s, hit: %s\n", facing, side, posNew, hitVec); return processRightClickBlockWrapper(controller, player, world, posNew, side, hitVec, hand); } @@ -585,7 +585,7 @@ else if (flexible == false || rotation == false) if (canPlaceBlockIntoPosition(world, posNew, ctx)) { - //Tweakeroo.debugLog("PlacementTweaks#tryPlaceBlock() pos: {}, side: {}, part: {}, hitVec: {}", posNew, side, hitPart, hitVec); + //System.out.printf("tryPlaceBlock() pos: %s, side: %s, part: %s, hitVec: %s\n", posNew, side, hitPart, hitVec); return handleFlexibleBlockPlacement(controller, player, world, posNew, side, playerYaw, hitVec, hand, hitPart); } else @@ -704,7 +704,7 @@ private static ActionResult processRightClickBlockWrapper( Vec3d hitVecIn, Hand hand) { - //Tweakeroo.debugLog("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); + //System.out.printf("processRightClickBlockWrapper() start @ %s, side: %s, hand: %s\n", pos, side, hand); if (FeatureToggle.TWEAK_PLACEMENT_LIMIT.getBooleanValue() && placementCount >= Configs.Generic.PLACEMENT_LIMIT.getIntegerValue()) { @@ -749,7 +749,7 @@ private static ActionResult processRightClickBlockWrapper( if (posFirst != null && isPositionAllowedByPlacementRestriction(posIn, sideIn) == false) { - //Tweakeroo.debugLog("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); + //System.out.printf("processRightClickBlockWrapper() PASS @ %s, side: %s\n", pos, side); return ActionResult.PASS; } @@ -779,7 +779,7 @@ private static ActionResult processRightClickBlockWrapper( x += afterClickerClickCount * 16; } - //Tweakeroo.debugLog("processRightClickBlockWrapper req facing: {}, x: {}, pos: {}, sideIn: {}", facing, x, posIn, sideIn); + //System.out.printf("processRightClickBlockWrapper req facing: %s, x: %.3f, pos: %s, sideIn: %s\n", facing, x, posIn, sideIn); hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } @@ -802,7 +802,7 @@ private static ActionResult processRightClickBlockWrapper( InventoryUtils.trySwapCurrentToolIfNearlyBroken(); - //Tweakeroo.debugLog("processRightClickBlockWrapper() pos:{}, side: {}, hitVec: {}", pos, side, hitVec); + //System.out.printf("processRightClickBlockWrapper() pos: %s, side: %s, hitVec: %s\n", pos, side, hitVec); ActionResult result; if (InventoryUtils.canUnstackingItemNotFitInInventory(stackOriginal, player)) @@ -811,7 +811,7 @@ private static ActionResult processRightClickBlockWrapper( } else { - //Tweakeroo.debugLog("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); + //System.out.printf("processRightClickBlockWrapper() PLACE @ %s, side: %s, hit: %s\n", pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posIn, false); result = controller.interactBlock(player, hand, context); } @@ -823,7 +823,7 @@ private static ActionResult processRightClickBlockWrapper( // This restock needs to happen even with the pick-before-place tweak active, // otherwise the fast placement mode's checks (getHandWithItem()) will fail... - //Tweakeroo.debugLog("processRightClickBlockWrapper -> tryRestockHand with: {}, current: {}", stackOriginal, player.getStackInHand(hand)); + //System.out.printf("processRightClickBlockWrapper -> tryRestockHand with: %s, current: %s\n", stackOriginal, player.getHeldItem(hand)); tryRestockHand(player, hand, stackOriginal); if (FeatureToggle.TWEAK_AFTER_CLICKER.getBooleanValue() && @@ -832,7 +832,7 @@ private static ActionResult processRightClickBlockWrapper( { for (int i = 0; i < afterClickerClickCount; i++) { - //Tweakeroo.debugLog("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s", i, pos, side, hitVec); + //System.out.printf("processRightClickBlockWrapper() after-clicker - i: %d, pos: %s, side: %s, hitVec: %s\n", i, pos, side, hitVec); BlockHitResult context = new BlockHitResult(hitVecIn, sideIn, posPlacement, false); result = controller.interactBlock(player, hand, context); } @@ -895,7 +895,7 @@ else if (hitPart == HitPart.RIGHT) player.setYaw(yaw); player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); - //Tweakeroo.debugLog("handleFlexibleBlockPlacement() pos: {}, side: {}, facing orig: yaw: {} / pitch: {} facing new: {}", pos, side, yaw, pitch, facing); + //System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); From 95067254953feaa80715d856212e6097d5a0b2f7 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Tue, 23 Apr 2024 15:22:38 -0400 Subject: [PATCH 078/128] 1.20.5-DEV --- gradle.properties | 12 ++++++------ src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8a0aa64bd..bbde476b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-rc3 +mod_version = 0.20.0-dev # Required malilib version -malilib_version = 0.19.0-rc3 +malilib_version = 0.19.0-dev.20240423.121323 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5-rc3 -minecraft_version = 1.20.5-rc3 -mappings_version = 1.20.5-rc3+build.2 +minecraft_version_out = 1.20.5 +minecraft_version = 1.20.5 +mappings_version = 1.20.5+build.1 fabric_loader_version = 0.15.10 -mod_menu_version = v10.0.0-alpha.3+1.20.5.c36bdf3 +mod_menu_version = 10.0.0-beta.1 fabric_api_version = 0.97.5+1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 148bd0b16..b552026bd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,8 +33,8 @@ ], "depends": { - "minecraft": ">=1.20.5-rc.3", - "malilib": ">=0.19.0-rc3" + "minecraft": ">=1.20.5", + "malilib": ">=0.19.0-dev" }, "custom": { "modmenu": { From 42f578fdfc52075cadfdf790c5a2e44b95b09e42 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:34:37 -0400 Subject: [PATCH 079/128] 1.20.5-DEV --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bbde476b3..4e3a2e335 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ mod_file_name = tweakeroo-fabric mod_version = 0.20.0-dev # Required malilib version -malilib_version = 0.19.0-dev.20240423.121323 +malilib_version = 0.19.0-dev.20240423.182049 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5 From 198a833a6acfa9fdb4bb7e1bda44d0f1122ef3a3 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:24:23 -0400 Subject: [PATCH 080/128] merge from PR --- .../java/fi/dy/masa/tweakeroo/event/InputHandler.java | 5 +++-- .../java/fi/dy/masa/tweakeroo/event/RenderHandler.java | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java index 480775040..8982981c8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java @@ -88,19 +88,20 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve MinecraftClient mc = MinecraftClient.getInstance(); if (mc.world == null || mc.player == null || mc.interactionManager == null || mc.crosshairTarget == null || - GuiUtils.getCurrentScreen() != null) + GuiUtils.getCurrentScreen() != null) { return false; } if (mc.player.isCreative() && FeatureToggle.TWEAK_ANGEL_BLOCK.getBooleanValue() && eventButtonState && - mc.options.useKey.matchesMouse(eventButton) && mc.crosshairTarget.getType() == HitResult.Type.MISS) + mc.options.useKey.matchesMouse(eventButton) && mc.crosshairTarget.getType() == HitResult.Type.MISS) { Vec3d eyePos = mc.player.getEyePos(); Vec3d rotVec = mc.player.getRotationVec(1.0f); Vec3d vec3d = eyePos.add(rotVec.multiply(Configs.Generic.ANGEL_BLOCK_PLACEMENT_DISTANCE.getDoubleValue())); BlockHitResult context = mc.world.raycast(new RaycastContext(eyePos, vec3d, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.SOURCE_ONLY, mc.player)); + for (Hand hand : Hand.values()) { ItemStack stack = mc.player.getStackInHand(hand); diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index da04fcd01..3e79f0d94 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,14 +1,14 @@ package fi.dy.masa.tweakeroo.event; import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.Item; import org.joml.Matrix4f; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.Entity; import net.minecraft.item.FilledMapItem; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; @@ -76,7 +76,7 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, if (item instanceof FilledMapItem) { if (FeatureToggle.TWEAK_MAP_PREVIEW.getBooleanValue() && - (!Configs.Generic.MAP_PREVIEW_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown())) + (Configs.Generic.MAP_PREVIEW_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown())) { fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } @@ -85,7 +85,7 @@ else if (stack.getComponents().contains(DataComponentTypes.CONTAINER)) { if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { - boolean render = !Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() || GuiBase.isShiftDown(); + boolean render = Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown(); if (render) { From 241433f9de09e3f30d2b8d465a3600c3a3b171fe Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 25 Apr 2024 16:00:47 -0400 Subject: [PATCH 081/128] "sakura.1" branding until official release --- gradle.properties | 6 +++--- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4e3a2e335..b5fa47f28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,10 +9,10 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.0-dev +mod_version = 0.20.999-sakura.1 # Required malilib version -malilib_version = 0.19.0-dev.20240423.182049 +malilib_version = 0.19.999-sakura.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5 @@ -21,4 +21,4 @@ mappings_version = 1.20.5+build.1 fabric_loader_version = 0.15.10 mod_menu_version = 10.0.0-beta.1 -fabric_api_version = 0.97.5+1.20.5 +fabric_api_version = 0.97.6+1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b552026bd..2aa95fc08 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "depends": { "minecraft": ">=1.20.5", - "malilib": ">=0.19.0-dev" + "malilib": ">=0.19.999-sakura.1" }, "custom": { "modmenu": { From d25960933ca4f845af2f1dbed2e323363bbf9b59 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 25 Apr 2024 16:52:43 -0400 Subject: [PATCH 082/128] "sakura.1" branding until official release --- gradle.properties | 4 ++-- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index b5fa47f28..0427fc351 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,10 +9,10 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.20.999-sakura.1 +mod_version = 0.19.999-sakura.1 # Required malilib version -malilib_version = 0.19.999-sakura.1 +malilib_version = 0.18.999-sakura.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.20.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2aa95fc08..33cf9305f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "depends": { "minecraft": ">=1.20.5", - "malilib": ">=0.19.999-sakura.1" + "malilib": ">=0.18.999-sakura.1" }, "custom": { "modmenu": { From b16b1d3c75d6564c3ece3827e06ab73203ce4e6b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:00:05 -0400 Subject: [PATCH 083/128] DISABLE_WORLD_VIEW_BOB Mixin Conflict with Iris, lower priority fixes it. --- gradle.properties | 2 +- src/main/java/fi/dy/masa/tweakeroo/config/Configs.java | 4 ++-- .../java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0427fc351..24b5707ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.999-sakura.1 +mod_version = 0.19.999-sakura.1a # Required malilib version malilib_version = 0.18.999-sakura.1 diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index 528c95f6f..bf7f6d85b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -280,7 +280,7 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "Disables boss bar rendering"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "Disables all client-side light updates"); public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); @@ -315,7 +315,7 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "Prevent all TileEntities from getting ticked"); public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "Prevents villager trades from ever locking, by always incrementing\nthe max uses as well when the recipe uses is incremented"); public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "Touching a wall doesn't drop you out from sprint mode"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand"); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "Disables the view bob wobble effect of the world, but not the hand\nThis setting will fail if you have Iris installed."); public static final ImmutableList OPTIONS = ImmutableList.of( DISABLE_ARMOR_STAND_RENDERING, diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index ffce18cb8..96da1713d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -27,7 +27,7 @@ import fi.dy.masa.tweakeroo.util.CameraUtils; import fi.dy.masa.tweakeroo.util.MiscUtils; -@Mixin(value = GameRenderer.class, priority = 1001) +@Mixin(value = GameRenderer.class, priority = 999) public abstract class MixinGameRenderer { @Shadow @Final MinecraftClient client; From 9bfc7048b0ede88befbea672824edd1ef832a4b5 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:55:42 -0400 Subject: [PATCH 084/128] DISABLE_WORLD_VIEW_BOB Mixin Conflict with Iris, lower priority fixes it. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 24b5707ed..244223068 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.999-sakura.1a +mod_version = 0.19.999-sakura.2 # Required malilib version malilib_version = 0.18.999-sakura.1 From 89f9303410940f0d36e33b841874f3be59c4cef0 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:54:57 -0400 Subject: [PATCH 085/128] 1.20.6 versioning --- gradle.properties | 8 ++++---- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 244223068..cfea824f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.19.999-sakura.2 malilib_version = 0.18.999-sakura.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.5 -minecraft_version = 1.20.5 -mappings_version = 1.20.5+build.1 +minecraft_version_out = 1.20.6 +minecraft_version = 1.20.6 +mappings_version = 1.20.6+build.1 fabric_loader_version = 0.15.10 mod_menu_version = 10.0.0-beta.1 -fabric_api_version = 0.97.6+1.20.5 +fabric_api_version = 0.97.8+1.20.6 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 33cf9305f..3daf474b9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.20.5", + "minecraft": ">=1.20.6", "malilib": ">=0.18.999-sakura.1" }, "custom": { From 3522047d72cd93cd627cf61b59e2f707b892eac9 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 3 May 2024 11:04:04 -0400 Subject: [PATCH 086/128] 24w18a -- new Item Enchantments Components --> Does not yet compile, no time to fix today. --- gradle.properties | 12 ++++++------ src/main/resources/fabric.mod.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index cfea824f8..3191b5664 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.999-sakura.2 +mod_version = 0.19.999-snap # Required malilib version -malilib_version = 0.18.999-sakura.1 +malilib_version = 0.18.999-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.20.6 -minecraft_version = 1.20.6 -mappings_version = 1.20.6+build.1 +minecraft_version_out = 24w18a +minecraft_version = 24w18a +mappings_version = 24w18a+build.1 -fabric_loader_version = 0.15.10 +fabric_loader_version = 0.15.11 mod_menu_version = 10.0.0-beta.1 fabric_api_version = 0.97.8+1.20.6 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3daf474b9..3aba15cf9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "depends": { "minecraft": ">=1.20.6", - "malilib": ">=0.18.999-sakura.1" + "malilib": ">=0.18.999-snap" }, "custom": { "modmenu": { From 4eee15a29ae7784b2c1e4bef65d4649a620a74b4 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 4 May 2024 16:14:31 -0400 Subject: [PATCH 087/128] fixed enchantment level lookups, build 3, api 0.97.9 --- gradle.properties | 4 +- .../masa/tweakeroo/renderer/RenderUtils.java | 53 ++++++++++++++----- .../masa/tweakeroo/util/InventoryUtils.java | 42 +++++++++++---- 3 files changed, 76 insertions(+), 23 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3191b5664..df46b379b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w18a minecraft_version = 24w18a -mappings_version = 24w18a+build.1 +mappings_version = 24w18a+build.3 fabric_loader_version = 0.15.11 mod_menu_version = 10.0.0-beta.1 -fabric_api_version = 0.97.8+1.20.6 +fabric_api_version = 0.97.9+1.21 diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index e880a00bf..6d975718c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.renderer; +import java.util.Set; import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Matrix4f; import org.joml.Matrix4fStack; @@ -11,15 +12,18 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.Camera; -import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.component.type.ItemEnchantmentsComponent; +import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.AbstractHorseEntity; import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; @@ -267,21 +271,46 @@ public static float getLavaFogDistance(Entity entity, float originalFog) { if (entity instanceof LivingEntity living) { - final int resp = EnchantmentHelper.getRespiration(living); - final int aqua = EnchantmentHelper.getEquipmentLevel(Enchantments.AQUA_AFFINITY, living); - float fog = (originalFog > 1.0f) ? 3.3f : 1.3f; + ItemStack head = living.getEquippedStack(EquipmentSlot.HEAD); - if (aqua > 0) + if (head.isEmpty() == false) { - fog *= 1.6f; - } + ItemEnchantmentsComponent enchants = head.getEnchantments(); + float fog = (originalFog > 1.0f) ? 3.3f : 1.3f; + int resp = 0; + int aqua = 0; - if (resp > 0) - { - fog *= (float) resp * 1.6f; - } + if (enchants.equals(ItemEnchantmentsComponent.DEFAULT) == false) + { + Set> enchantList = enchants.getEnchantments(); + + for (RegistryEntry entry : enchantList) + { + if (entry.matchesKey(Enchantments.AQUA_AFFINITY)) + { + aqua = enchants.getLevel(entry); + } + if (entry.matchesKey(Enchantments.RESPIRATION)) + { + resp = enchants.getLevel(entry); + } + } + } - return Math.max(fog, originalFog); + if (aqua > 0) + { + fog *= 1.6f; + } + + if (resp > 0) + { + fog *= (float) resp * 1.6f; + } + + //Tweakeroo.logger.info("getLavaFogDistance: aqua {} resp {} orig: {} adjusted {}", aqua, resp, originalFog, fog); + + return Math.max(fog, originalFog); + } } return originalFog; diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index e9526376f..055bb3c79 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.util; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; import java.util.function.Predicate; @@ -11,7 +12,8 @@ import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.AttributeModifiersComponent; import net.minecraft.component.type.ContainerComponent; -import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.component.type.ItemEnchantmentsComponent; +import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -22,6 +24,8 @@ import net.minecraft.item.*; import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket; import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.Slot; @@ -497,6 +501,26 @@ public static void trySwitchToEffectiveTool(BlockPos pos) } } + public static int getEnchantmentLevel(ItemStack stack, @Nonnull RegistryKey enchantment) + { + ItemEnchantmentsComponent enchants = stack.getEnchantments(); + + if (enchants.equals(ItemEnchantmentsComponent.DEFAULT) == false) + { + Set> enchantList = enchants.getEnchantments(); + + for (RegistryEntry entry : enchantList) + { + if (entry.matchesKey(enchantment)) + { + return enchants.getLevel(entry); + } + } + } + + return -1; + } + private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { return testedStack.isEmpty() == false && isMoreEffectiveTool(testedStack, previousTool, state); @@ -518,7 +542,7 @@ protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState sta if (speed > 1.0f) { - int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); + int effLevel = getEnchantmentLevel(stack, Enchantments.EFFICIENCY); if (effLevel > 0) { @@ -690,7 +714,7 @@ private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type if (stack.isEmpty() == false && (stack.isDamageable() == false || stack.isDamaged() == false || - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) <= 0)) + getEnchantmentLevel(stack, Enchantments.MENDING) <= 0)) { Slot slot = player.currentScreenHandler.getSlot(slotNum); int slotRepairableItem = findRepairableItemNotInRepairableSlot(slot, player); @@ -716,7 +740,7 @@ private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, Player // Don't take items from the current hotbar slot if ((slot.id - 36) != player.getInventory().selectedSlot && stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && - EnchantmentHelper.getLevel(Enchantments.MENDING, stack) > 0) + getEnchantmentLevel(stack, Enchantments.MENDING) > 0) { return slot.id; } @@ -933,18 +957,18 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) { - int level = EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stackReference); + int level = getEnchantmentLevel(stackReference, Enchantments.SILK_TOUCH); if (level > 0) { - return EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) >= level; + return getEnchantmentLevel(stack, Enchantments.SILK_TOUCH) >= level; } - level = EnchantmentHelper.getLevel(Enchantments.FORTUNE, stackReference); + level = getEnchantmentLevel(stackReference, Enchantments.FORTUNE); if (level > 0) { - return EnchantmentHelper.getLevel(Enchantments.FORTUNE, stack) >= level; + return getEnchantmentLevel(stack, Enchantments.FORTUNE) >= level; } return true; @@ -971,7 +995,7 @@ private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler con if (speed > 1.0f) { - int effLevel = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); + int effLevel = getEnchantmentLevel(stack, Enchantments.EFFICIENCY); if (effLevel > 0) { From 3204f887d42abe44f74d1ae147c785801b081441 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 4 May 2024 17:16:36 -0400 Subject: [PATCH 088/128] fixed enchantment level lookups, build 3, api 0.97.9 --- src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 055bb3c79..28391fa31 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -518,6 +518,12 @@ public static int getEnchantmentLevel(ItemStack stack, @Nonnull RegistryKey Registry-Required method + /* + Optional> optional = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntry(enchantment); + return optional.map(enchantmentReference -> EnchantmentHelper.getLevel(enchantmentReference, stack)).orElse(-1); + */ + return -1; } From 1633808a7b7bb0c17eca16a019d9c4f95705acce Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 10 May 2024 16:50:30 -0400 Subject: [PATCH 089/128] Update gradle.properties --- gradle.properties | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index df46b379b..a00b4e119 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,11 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w18a -minecraft_version = 24w18a -mappings_version = 24w18a+build.3 +minecraft_version_out = 24w19b +minecraft_version = 24w19b +mappings_version = 24w19b+build.2 fabric_loader_version = 0.15.11 -mod_menu_version = 10.0.0-beta.1 -fabric_api_version = 0.97.9+1.21 +mod_menu_version = 24w19a-SNAP+24w19b-SNAP.e7969cf +fabric_api_version = 0.98.1+1.21 + From ec596b63a23bec8c4c914332565d6c697d6a4728 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 10 May 2024 20:48:45 -0400 Subject: [PATCH 090/128] version bump --- gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a00b4e119..4bdfaafdf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,4 +22,3 @@ mappings_version = 24w19b+build.2 fabric_loader_version = 0.15.11 mod_menu_version = 24w19a-SNAP+24w19b-SNAP.e7969cf fabric_api_version = 0.98.1+1.21 - From 1b0322c851107e635f5b505f83f832e5a121b485 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 11 May 2024 14:13:52 -0400 Subject: [PATCH 091/128] fix shulker box / item container display. --- .../java/fi/dy/masa/tweakeroo/event/RenderHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 3e79f0d94..60e850aab 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -17,6 +17,7 @@ import fi.dy.masa.malilib.interfaces.IRenderer; import fi.dy.masa.malilib.util.ActiveMode; import fi.dy.masa.malilib.util.Color4f; +import fi.dy.masa.malilib.util.InventoryUtils; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.config.Hotkeys; @@ -81,13 +82,11 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); } } - else if (stack.getComponents().contains(DataComponentTypes.CONTAINER)) + else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && InventoryUtils.shulkerBoxHasItems(stack)) { if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) { - boolean render = Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown(); - - if (render) + if (Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown()) { fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); } From 67ef211241b274e00304b425d097b960ebb34029 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 11 May 2024 14:28:57 -0400 Subject: [PATCH 092/128] Update RenderHandler.java --- .../java/fi/dy/masa/tweakeroo/event/RenderHandler.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index 60e850aab..204930689 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -84,12 +84,10 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, } else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && InventoryUtils.shulkerBoxHasItems(stack)) { - if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue()) + if (FeatureToggle.TWEAK_SHULKERBOX_DISPLAY.getBooleanValue() && + (Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown())) { - if (Configs.Generic.SHULKER_DISPLAY_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown()) - { - fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); - } + fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); } } } From 414fe2e1466af3be7e2cbf85b53d4087ff81b12c Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 16 May 2024 00:36:24 -0400 Subject: [PATCH 093/128] fix render call, add tickDelta fixes --- gradle.properties | 6 +++--- .../java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java | 2 +- .../java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java | 8 +++++--- ...nkStorage.java => MixinServerChunkLoadingManager.java} | 8 ++++---- .../fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java | 5 +++-- .../java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java | 6 ++++-- .../java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 3 ++- src/main/resources/mixins.tweakeroo.json | 2 +- 8 files changed, 23 insertions(+), 17 deletions(-) rename src/main/java/fi/dy/masa/tweakeroo/mixin/{MixinThreadedAnvilChunkStorage.java => MixinServerChunkLoadingManager.java} (68%) diff --git a/gradle.properties b/gradle.properties index 4bdfaafdf..3dff66bef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,9 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric and mappings versions -minecraft_version_out = 24w19b -minecraft_version = 24w19b -mappings_version = 24w19b+build.2 +minecraft_version_out = 24w20a +minecraft_version = 24w20a +mappings_version = 24w20a+build.2 fabric_loader_version = 0.15.11 mod_menu_version = 24w19a-SNAP+24w19b-SNAP.e7969cf diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java index cfcda3a58..5916350f4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChatHud.java @@ -18,7 +18,7 @@ @Mixin(value = ChatHud.class, priority = 1100) public abstract class MixinChatHud { - @ModifyVariable(method = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", + @ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), argsOnly = true) private Text tweakeroo_addMessageTimestamp(Text componentIn, Text parameterMessage, MessageSignatureData data, MessageIndicator indicator) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index d290de596..1b68d0986 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.class_9779; import net.minecraft.scoreboard.ScoreboardDisplaySlot; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -43,7 +44,8 @@ private void overrideCursorRender(CallbackInfo ci) { if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { - RenderUtils.renderDirectionsCursor(0, this.client.getTickDelta()); + // FIXME + RenderUtils.renderDirectionsCursor(0, this.client.method_60646().method_60637(false)); ci.cancel(); } } @@ -52,7 +54,7 @@ private void overrideCursorRender(CallbackInfo ci) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", ordinal = 1, shift = At.Shift.AFTER)) - private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, CallbackInfo ci) + private void alwaysRenderPlayerList(DrawContext context, class_9779 arg, CallbackInfo ci) { if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { @@ -60,7 +62,7 @@ private void alwaysRenderPlayerList(DrawContext drawContext, float tickDelta, Ca ScoreboardObjective objective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.LIST); this.playerListHud.setVisible(true); - this.playerListHud.render(drawContext, drawContext.getScaledWindowWidth(), scoreboard, objective); + this.playerListHud.render(context, context.getScaledWindowWidth(), scoreboard, objective); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerChunkLoadingManager.java similarity index 68% rename from src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java rename to src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerChunkLoadingManager.java index 27cd43ff9..ccacc13ef 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinThreadedAnvilChunkStorage.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinServerChunkLoadingManager.java @@ -5,14 +5,14 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.server.world.ThreadedAnvilChunkStorage; +import net.minecraft.server.world.ServerChunkLoadingManager; import fi.dy.masa.tweakeroo.config.Configs; -@Mixin(ThreadedAnvilChunkStorage.class) -public abstract class MixinThreadedAnvilChunkStorage +@Mixin(ServerChunkLoadingManager.class) +public abstract class MixinServerChunkLoadingManager { @Inject(method = "unloadChunks", cancellable = true, at = @At(value = "FIELD", - target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;chunkHolders:Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;")) + target = "Lnet/minecraft/server/world/ServerChunkLoadingManager;currentChunkHolders:Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;")) private void tweakeroo_disableSaving20ChunksEveryTick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) { if (Configs.Disable.DISABLE_CONSTANT_CHUNK_SAVING.getBooleanValue()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index 5b2954bfb..cb8482342 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.minecraft.class_9779; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.Frustum; @@ -49,7 +50,7 @@ private void cancelRainRender(LightmapTextureManager lightmap, float partialTick @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void preSetupTerrain(class_9779 arg, boolean bl, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -59,7 +60,7 @@ private void preSetupTerrain(float tickDelta, long limitTime, boolean renderBloc @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void postSetupTerrain(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void postSetupTerrain(class_9779 arg, boolean bl, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 2b4633b94..f06fe9966 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -228,7 +228,8 @@ private static void onUsingTick() final double reach = mc.player.getBlockInteractionRange(); final int maxCount = Configs.Generic.FAST_BLOCK_PLACEMENT_COUNT.getIntegerValue(); - mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); + // FIXME + mc.crosshairTarget = player.raycast(reach, mc.method_60646().method_60637(false), false); for (int i = 0; i < maxCount; ++i) { @@ -276,7 +277,8 @@ private static void onUsingTick() if (result == ActionResult.SUCCESS) { posLast = posNew; - mc.crosshairTarget = player.raycast(reach, mc.getTickDelta(), false); + // FIXME + mc.crosshairTarget = player.raycast(reach, mc.method_60646().method_60637(false), false); } else { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 28391fa31..32c48778e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1108,7 +1108,8 @@ public static void switchToPickedBlock() double reach = mc.player.getBlockInteractionRange(); boolean isCreative = player.isCreative(); - HitResult trace = player.raycast(reach, mc.getTickDelta(), false); + // FIXME + HitResult trace = player.raycast(reach, mc.method_60646().method_60637(false), false); if (trace != null && trace.getType() == HitResult.Type.BLOCK) { diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index a462c962b..1f80d5714 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -68,7 +68,7 @@ "MixinSlimeBlock", "MixinStructureBlockBlockEntity", "MixinTeleportSpectatorMenu", - "MixinThreadedAnvilChunkStorage", + "MixinServerChunkLoadingManager", "MixinTradeOffer", "MixinUpdateStructureBlockC2SPacket", "MixinWindow", From d5155daa1188c3c1cccec028122b87ac98277bbf Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 16 May 2024 09:22:20 -0400 Subject: [PATCH 094/128] yarn build 3, waiting on FAPI --- gradle.properties | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java | 11 ++++------- .../dy/masa/tweakeroo/mixin/MixinWorldRenderer.java | 11 +++-------- .../fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java | 6 ++---- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 3 +-- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3dff66bef..0b70d0a51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric and mappings versions minecraft_version_out = 24w20a minecraft_version = 24w20a -mappings_version = 24w20a+build.2 +mappings_version = 24w20a+build.3 fabric_loader_version = 0.15.11 mod_menu_version = 24w19a-SNAP+24w19b-SNAP.e7969cf diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java index 1b68d0986..d32af29e1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinInGameHud.java @@ -1,7 +1,5 @@ package fi.dy.masa.tweakeroo.mixin; -import net.minecraft.class_9779; -import net.minecraft.scoreboard.ScoreboardDisplaySlot; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -9,15 +7,15 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.PlayerListHud; +import net.minecraft.client.render.RenderTickCounter; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.ScoreboardDisplaySlot; import net.minecraft.scoreboard.ScoreboardObjective; - import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.renderer.RenderUtils; @@ -44,8 +42,7 @@ private void overrideCursorRender(CallbackInfo ci) { if (FeatureToggle.TWEAK_F3_CURSOR.getBooleanValue()) { - // FIXME - RenderUtils.renderDirectionsCursor(0, this.client.method_60646().method_60637(false)); + RenderUtils.renderDirectionsCursor(0, this.client.getRenderTickCounter().getTickDelta(false)); ci.cancel(); } } @@ -54,7 +51,7 @@ private void overrideCursorRender(CallbackInfo ci) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setVisible(Z)V", ordinal = 1, shift = At.Shift.AFTER)) - private void alwaysRenderPlayerList(DrawContext context, class_9779 arg, CallbackInfo ci) + private void alwaysRenderPlayerList(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { if (FeatureToggle.TWEAK_PLAYER_LIST_ALWAYS_ON.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index cb8482342..668415b8e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -8,13 +8,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.class_9779; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.Frustum; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.LightmapTextureManager; -import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.render.*; import net.minecraft.entity.Entity; import net.minecraft.util.math.MathHelper; import fi.dy.masa.tweakeroo.config.Configs; @@ -50,7 +45,7 @@ private void cancelRainRender(LightmapTextureManager lightmap, float partialTick @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void preSetupTerrain(class_9779 arg, boolean bl, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void preSetupTerrain(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -60,7 +55,7 @@ private void preSetupTerrain(class_9779 arg, boolean bl, Camera camera, GameRend @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void postSetupTerrain(class_9779 arg, boolean bl, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void postSetupTerrain(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index f06fe9966..d94c2b125 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -228,8 +228,7 @@ private static void onUsingTick() final double reach = mc.player.getBlockInteractionRange(); final int maxCount = Configs.Generic.FAST_BLOCK_PLACEMENT_COUNT.getIntegerValue(); - // FIXME - mc.crosshairTarget = player.raycast(reach, mc.method_60646().method_60637(false), false); + mc.crosshairTarget = player.raycast(reach, mc.getRenderTickCounter().getTickDelta(false), false); for (int i = 0; i < maxCount; ++i) { @@ -277,8 +276,7 @@ private static void onUsingTick() if (result == ActionResult.SUCCESS) { posLast = posNew; - // FIXME - mc.crosshairTarget = player.raycast(reach, mc.method_60646().method_60637(false), false); + mc.crosshairTarget = player.raycast(reach, mc.getRenderTickCounter().getTickDelta(false), false); } else { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 32c48778e..ca52473d8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -1108,8 +1108,7 @@ public static void switchToPickedBlock() double reach = mc.player.getBlockInteractionRange(); boolean isCreative = player.isCreative(); - // FIXME - HitResult trace = player.raycast(reach, mc.method_60646().method_60637(false), false); + HitResult trace = player.raycast(reach, mc.getRenderTickCounter().getTickDelta(false), false); if (trace != null && trace.getType() == HitResult.Type.BLOCK) { From 2752951736eccfd27fddc90c7fde7e4f8946be74 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 17 May 2024 09:52:39 -0400 Subject: [PATCH 095/128] FAPI / modmenu update --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0b70d0a51..64c674b22 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,11 +14,11 @@ mod_version = 0.19.999-snap # Required malilib version malilib_version = 0.18.999-snap -# Minecraft, Fabric and mappings versions +# Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 24w20a minecraft_version = 24w20a mappings_version = 24w20a+build.3 fabric_loader_version = 0.15.11 -mod_menu_version = 24w19a-SNAP+24w19b-SNAP.e7969cf -fabric_api_version = 0.98.1+1.21 +mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 +fabric_api_version = 0.98.2+1.21 From fb763c565156f060f1cc914660b3bbe0d64af6a3 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 19 May 2024 09:04:23 -0400 Subject: [PATCH 096/128] Update fabric.mod.json --- src/main/resources/fabric.mod.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3aba15cf9..315e956c4 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -35,10 +35,5 @@ "depends": { "minecraft": ">=1.20.6", "malilib": ">=0.18.999-snap" - }, - "custom": { - "modmenu": { - "parent": "malilib" - } } } From bcf2529de7258598c27e687070cb7d73e1fe004b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 19 May 2024 13:49:32 -0400 Subject: [PATCH 097/128] Upgrade Shulker Box stacking code -- this allows non-modded players and non-modded servers to work with Tweakeroo stacked shulker boxes. --- .../dy/masa/tweakeroo/mixin/MixinBlockItem.java | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinItem.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinItemStack.java | 15 ++++++++++++++- .../dy/masa/tweakeroo/util/IItemStackLimit.java | 2 +- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 14 ++++++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index 356d89b9c..e51498ac5 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -68,7 +68,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx */ @Override - public int getMaxStackSize(ItemStack stack) + public Integer getMaxStackSize(ItemStack stack) { if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index c405ba383..488c9b1b7 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -11,7 +11,7 @@ public abstract class MixinItem implements IItemStackLimit @Shadow public abstract Item asItem(); @Override - public int getMaxStackSize(net.minecraft.item.ItemStack stack) + public Integer getMaxStackSize(net.minecraft.item.ItemStack stack) { return this.asItem().getMaxCount(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index 3e95230d1..e8a23a479 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -5,9 +5,12 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import fi.dy.masa.tweakeroo.util.IItemStackLimit; +import fi.dy.masa.tweakeroo.util.InventoryUtils; @Mixin(ItemStack.class) public abstract class MixinItemStack @@ -15,9 +18,19 @@ public abstract class MixinItemStack @Shadow public abstract Item getItem(); + @Shadow public abstract ComponentMap getComponents(); + @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) { - ci.setReturnValue(((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this)); + Integer new_max_size = ((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this); + Integer orig_max_size = this.getComponents().getOrDefault(DataComponentTypes.MAX_STACK_SIZE, 1); + + if (orig_max_size < new_max_size) + { + // Sets the Data Component manually + InventoryUtils.updateMaxStackSize((ItemStack) (Object) this, new_max_size); + } + ci.setReturnValue(new_max_size >= orig_max_size ? new_max_size : orig_max_size); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java index 62a4ad177..2c64a69a6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java @@ -4,5 +4,5 @@ public interface IItemStackLimit { - int getMaxStackSize(ItemStack stack); + Integer getMaxStackSize(ItemStack stack); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index ca52473d8..4a57aa02f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; +import net.minecraft.component.ComponentChanges; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.AttributeModifiersComponent; import net.minecraft.component.type.ContainerComponent; @@ -1175,4 +1176,17 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) return changed; } + + public static boolean updateMaxStackSize(ItemStack stackIn, Integer newSize) + { + if (stackIn.isEmpty() == false && Objects.equals(stackIn.getComponents().get(DataComponentTypes.MAX_STACK_SIZE), newSize) == false) + { + Tweakeroo.logger.info("updateMaxStackSize(): applying changes to {}", newSize); + stackIn.applyChanges(ComponentChanges.builder().add(DataComponentTypes.MAX_STACK_SIZE, newSize).build()); + + return true; + } + + return false; + } } From ff4b7525eda4241da541914998a9ead85df5546f Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 19 May 2024 14:45:29 -0400 Subject: [PATCH 098/128] Revert last Commit --- .../dy/masa/tweakeroo/mixin/MixinBlockItem.java | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinItem.java | 2 +- .../dy/masa/tweakeroo/mixin/MixinItemStack.java | 15 +-------------- .../dy/masa/tweakeroo/util/IItemStackLimit.java | 2 +- .../fi/dy/masa/tweakeroo/util/InventoryUtils.java | 14 -------------- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java index e51498ac5..356d89b9c 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBlockItem.java @@ -68,7 +68,7 @@ private BlockState modifyPlacementState(BlockItem item, ItemPlacementContext ctx */ @Override - public Integer getMaxStackSize(ItemStack stack) + public int getMaxStackSize(ItemStack stack) { if (FeatureToggle.TWEAK_SHULKERBOX_STACKING.getBooleanValue() && ((BlockItem) (Object) this).getBlock() instanceof ShulkerBoxBlock && diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java index 488c9b1b7..c405ba383 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItem.java @@ -11,7 +11,7 @@ public abstract class MixinItem implements IItemStackLimit @Shadow public abstract Item asItem(); @Override - public Integer getMaxStackSize(net.minecraft.item.ItemStack stack) + public int getMaxStackSize(net.minecraft.item.ItemStack stack) { return this.asItem().getMaxCount(); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index e8a23a479..3e95230d1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -5,12 +5,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.component.ComponentMap; -import net.minecraft.component.DataComponentTypes; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import fi.dy.masa.tweakeroo.util.IItemStackLimit; -import fi.dy.masa.tweakeroo.util.InventoryUtils; @Mixin(ItemStack.class) public abstract class MixinItemStack @@ -18,19 +15,9 @@ public abstract class MixinItemStack @Shadow public abstract Item getItem(); - @Shadow public abstract ComponentMap getComponents(); - @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) { - Integer new_max_size = ((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this); - Integer orig_max_size = this.getComponents().getOrDefault(DataComponentTypes.MAX_STACK_SIZE, 1); - - if (orig_max_size < new_max_size) - { - // Sets the Data Component manually - InventoryUtils.updateMaxStackSize((ItemStack) (Object) this, new_max_size); - } - ci.setReturnValue(new_max_size >= orig_max_size ? new_max_size : orig_max_size); + ci.setReturnValue(((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this)); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java index 2c64a69a6..62a4ad177 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IItemStackLimit.java @@ -4,5 +4,5 @@ public interface IItemStackLimit { - Integer getMaxStackSize(ItemStack stack); + int getMaxStackSize(ItemStack stack); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 4a57aa02f..ca52473d8 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -9,7 +9,6 @@ import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; -import net.minecraft.component.ComponentChanges; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.AttributeModifiersComponent; import net.minecraft.component.type.ContainerComponent; @@ -1176,17 +1175,4 @@ public static boolean cleanUpShulkerBoxNBT(ItemStack stack) return changed; } - - public static boolean updateMaxStackSize(ItemStack stackIn, Integer newSize) - { - if (stackIn.isEmpty() == false && Objects.equals(stackIn.getComponents().get(DataComponentTypes.MAX_STACK_SIZE), newSize) == false) - { - Tweakeroo.logger.info("updateMaxStackSize(): applying changes to {}", newSize); - stackIn.applyChanges(ComponentChanges.builder().add(DataComponentTypes.MAX_STACK_SIZE, newSize).build()); - - return true; - } - - return false; - } } From 1bc8cff202eea2582d423c1168914ca99e7ee49a Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 22 May 2024 18:07:36 -0400 Subject: [PATCH 099/128] fix config minorly --- src/main/java/fi/dy/masa/tweakeroo/config/Configs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index bf7f6d85b..afeed3667 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -280,7 +280,7 @@ public static class Disable public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "Disables the double-tap-forward-key sprinting"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "Disables boss bar rendering"); public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "Removes the fog that boss mobs cause"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\nThis might help with low fps in places with lots of block changes in some situations,\\nwhere the block changes are not really relevant at that time."); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "Disables chunk (re-)rendering. This will make any block changes non-visible\nuntil this is disabled again and F3 + A is used to refresh the world rendering.\nThis might help with low fps in places with lots of block changes in some situations,\nwhere the block changes are not really relevant at that time."); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "Disables ALL except player entity updates on the client.\nThis is mainly meant for situations where you need to be\nable to do stuff to fix excessive entity count related problems"); public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "Disables all client-side light updates"); public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "Disables the game saving up to 20 chunks every tick\nall the time, in addition to the normal auto-save cycle."); From 63dc3c384cbaf51fbe2d5d0cbaed5030e03cc377 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 22 May 2024 19:36:53 -0400 Subject: [PATCH 100/128] 24w21b - Waiting on FAPI --- gradle.properties | 8 ++++---- .../dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java | 7 +++---- src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java | 2 +- .../java/fi/dy/masa/tweakeroo/util/EntityRestriction.java | 2 +- .../java/fi/dy/masa/tweakeroo/util/InventoryUtils.java | 6 +++--- .../java/fi/dy/masa/tweakeroo/util/ItemRestriction.java | 2 +- .../java/fi/dy/masa/tweakeroo/util/PotionRestriction.java | 6 ++---- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/gradle.properties b/gradle.properties index 64c674b22..836019e52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 24w20a -minecraft_version = 24w20a -mappings_version = 24w20a+build.3 +minecraft_version_out = 24w21b +minecraft_version = 24w21b +mappings_version = 24w21b+build.1 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 -fabric_api_version = 0.98.2+1.21 +fabric_api_version = 0.99.0+1.21 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java index d62850445..0030bd3b2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java @@ -42,7 +42,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) super(world, profile); } - @Redirect(method = "updateNausea()V", + @Redirect(method = "method_60887", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;shouldPause()Z")) private boolean onDoesGuiPauseGame(Screen gui) @@ -56,7 +56,7 @@ private boolean onDoesGuiPauseGame(Screen gui) return gui.shouldPause(); } - @Inject(method = "updateNausea", at = @At("HEAD")) + @Inject(method = "method_60887", at = @At("HEAD")) private void disableNauseaEffectPre(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) @@ -65,8 +65,7 @@ private void disableNauseaEffectPre(CallbackInfo ci) } } - @Inject(method = "updateNausea", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/network/ClientPlayerEntity;tickPortalCooldown()V")) + @Inject(method = "method_60887", at = @At(value = "TAIL")) private void disableNauseaEffectPost(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index c8f13a822..66e6510bc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -337,7 +337,7 @@ private static Block getBlockFromName(String name) { try { - Identifier identifier = new Identifier(name); + Identifier identifier = Identifier.tryParse(name); return Registries.BLOCK.getOrEmpty(identifier).orElse(null); } catch (Exception e) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java index bc8e9209f..c4dcd708e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java @@ -18,7 +18,7 @@ protected void setValuesForList(Set> set, List names) { try { - Optional> entityType = Registries.ENTITY_TYPE.getOrEmpty(new Identifier(name)); + Optional> entityType = Registries.ENTITY_TYPE.getOrEmpty(Identifier.tryParse(name)); if (entityType.isPresent()) { set.add(entityType.get()); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index ca52473d8..80f074ef6 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -127,7 +127,7 @@ public static void setUnstackingItems(List names) { try { - Item item = Registries.ITEM.get(new Identifier(name)); + Item item = Registries.ITEM.get(Identifier.tryParse(name)); if (item != null && item != Items.AIR) { @@ -198,7 +198,7 @@ public static void setWeaponMapping(List mappings) { try { - Optional weapon = Registries.ITEM.getOrEmpty(new Identifier(itemId)); + Optional weapon = Registries.ITEM.getOrEmpty(Identifier.tryParse(itemId)); if (weapon.isPresent()) { @@ -222,7 +222,7 @@ public static void setWeaponMapping(List mappings) { try { - Optional> entity = Registries.ENTITY_TYPE.getOrEmpty(new Identifier(entity_id)); + Optional> entity = Registries.ENTITY_TYPE.getOrEmpty(Identifier.tryParse(entity_id)); if (entity.isPresent()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java index 98dc3a7c6..c10aabcb9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java @@ -32,7 +32,7 @@ protected void setValuesForList(ListType type, List names) { try { - Item item = Registries.ITEM.get(new Identifier(name)); + Item item = Registries.ITEM.get(Identifier.tryParse(name)); if (item != null && item != Items.AIR) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java index 9952f5dc8..9be99b24b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java @@ -19,11 +19,9 @@ protected void setValuesForList(Set set, List names) try { - rl = new Identifier(name); - } - catch (Exception e) - { + rl = Identifier.tryParse(name); } + catch (Exception ignored) { } StatusEffect effect = rl != null ? Registries.STATUS_EFFECT.get(rl) : null; From 5ade0e0c511929b14a8c0759da810d83125fa2f8 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 23 May 2024 02:10:46 -0400 Subject: [PATCH 101/128] yarn build 3 --- gradle.properties | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 836019e52..14b35a150 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 24w21b minecraft_version = 24w21b -mappings_version = 24w21b+build.1 +mappings_version = 24w21b+build.3 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java index 0030bd3b2..7bdfa8a70 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerEntity.java @@ -42,7 +42,7 @@ private MixinClientPlayerEntity(ClientWorld world, GameProfile profile) super(world, profile); } - @Redirect(method = "method_60887", + @Redirect(method = "tickNausea", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;shouldPause()Z")) private boolean onDoesGuiPauseGame(Screen gui) @@ -56,7 +56,7 @@ private boolean onDoesGuiPauseGame(Screen gui) return gui.shouldPause(); } - @Inject(method = "method_60887", at = @At("HEAD")) + @Inject(method = "tickNausea", at = @At("HEAD")) private void disableNauseaEffectPre(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) @@ -65,7 +65,7 @@ private void disableNauseaEffectPre(CallbackInfo ci) } } - @Inject(method = "method_60887", at = @At(value = "TAIL")) + @Inject(method = "tickNausea", at = @At(value = "TAIL")) private void disableNauseaEffectPost(CallbackInfo ci) { if (Configs.Disable.DISABLE_NAUSEA_EFFECT.getBooleanValue()) From 537bf8382b9384fc205a6594866e10b8f3d18421 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 23 May 2024 08:39:10 -0400 Subject: [PATCH 102/128] FAPI update, and testing. All seems to be working. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 14b35a150..9f8e4488a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,4 @@ mappings_version = 24w21b+build.3 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 -fabric_api_version = 0.99.0+1.21 +fabric_api_version = 0.99.1+1.21 From 491b0352a6200d31eec058622ab9a41d4397d0cd Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 23 May 2024 16:25:06 -0400 Subject: [PATCH 103/128] getItemStackFromString check for null --- src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java index 06e09baab..6026f3077 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CreativeExtraItems.java @@ -63,7 +63,7 @@ private static void setCreativeExtraItems(ItemGroup group, List items) { ItemStack stack = InventoryUtils.getItemStackFromString(str); - if (stack.isEmpty() == false) + if (stack != null && stack.isEmpty() == false) { if (stack.getComponents().isEmpty() == false) { From a210ed59a2f233c7dcc1807cfd7cef0d5419c47b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Thu, 23 May 2024 16:58:48 -0400 Subject: [PATCH 104/128] yard build 4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9f8e4488a..9d2200bfa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 24w21b minecraft_version = 24w21b -mappings_version = 24w21b+build.3 +mappings_version = 24w21b+build.4 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 From 5f95412dba11153fc61f99decd3afe7c1871e5a4 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 25 May 2024 09:05:35 -0400 Subject: [PATCH 105/128] yarn build 5 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9d2200bfa..9aace3fd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 24w21b minecraft_version = 24w21b -mappings_version = 24w21b+build.4 +mappings_version = 24w21b+build.5 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 From 48ac804196c2781976989940986d052cdc7bdc34 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 29 May 2024 06:40:26 -0400 Subject: [PATCH 106/128] yarn build 8 --- gradle.properties | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java | 4 ++-- .../java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9aace3fd6..0f8b9c585 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 24w21b minecraft_version = 24w21b -mappings_version = 24w21b+build.5 +mappings_version = 24w21b+build.8 fabric_loader_version = 0.15.11 mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 8216ee771..e55859d53 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -21,7 +21,7 @@ public abstract class MixinBackgroundRenderer method = "applyFog", slice = @Slice( from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/registry/entry/RegistryEntry;"), - to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), + to = @At(value = "FIELD", target = "Lnet/minecraft/block/enums/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/block/enums/CameraSubmersionType;")), constant = @Constant(floatValue = 0.25f), require = 0) private static float reduceLavaFogStart(float original) @@ -40,7 +40,7 @@ private static float reduceLavaFogStart(float original) method = "applyFog", slice = @Slice( from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;FIRE_RESISTANCE:Lnet/minecraft/registry/entry/RegistryEntry;"), - to = @At(value = "FIELD", target = "Lnet/minecraft/client/render/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/client/render/CameraSubmersionType;")), + to = @At(value = "FIELD", target = "Lnet/minecraft/block/enums/CameraSubmersionType;POWDER_SNOW:Lnet/minecraft/block/enums/CameraSubmersionType;")), constant = { @Constant(floatValue = 1.0f), @Constant(floatValue = 5.0f)}, require = 0) private static float reduceLavaFogEnd(float original) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java index 56d9962f0..e52d6ecce 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinShulkerBoxBlock.java @@ -6,9 +6,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.block.ShulkerBoxBlock; -import net.minecraft.client.item.TooltipType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Text; import fi.dy.masa.tweakeroo.config.Configs; From bde605a354849700b71781268a9fe9d6b64debcc Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 29 May 2024 14:31:00 -0400 Subject: [PATCH 107/128] 1.21-pre1 --- gradle.properties | 10 +++++----- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0f8b9c585..569fc9f18 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 24w21b -minecraft_version = 24w21b -mappings_version = 24w21b+build.8 +minecraft_version_out = 1.21-pre1 +minecraft_version = 1.21-pre1 +mappings_version = 1.21-pre1+build.3 fabric_loader_version = 0.15.11 -mod_menu_version = 24w19b-snap+24w20a-SNAP.35cf355 -fabric_api_version = 0.99.1+1.21 +mod_menu_version = v10.0.0-beta.1+1.21-pre.1.ec8c7ec +fabric_api_version = 0.99.2+1.21 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 315e956c4..bdcdfb8d6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.20.6", + "minecraft": ">=1.21-beta.1", "malilib": ">=0.18.999-snap" } } From 5a80de3b516aa3f4cdf77f1dca575f405fc7d85d Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Fri, 31 May 2024 16:07:51 -0400 Subject: [PATCH 108/128] 1.21-pre2 --> added tool / weapon swap parameters to check the item 'weight' with Rarity and enchantments versus the previous Item. i.e.; a tool with more enchantments, or higher enchantment values is picked over the same item with lesser rarity. --- gradle.properties | 8 +- .../fi/dy/masa/tweakeroo/config/Configs.java | 2 +- .../masa/tweakeroo/util/InventoryUtils.java | 119 ++++++++++++++++-- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 114 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index 569fc9f18..e8c676767 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 1.21-pre1 -minecraft_version = 1.21-pre1 -mappings_version = 1.21-pre1+build.3 +minecraft_version_out = 1.21-pre2 +minecraft_version = 1.21-pre2 +mappings_version = 1.21-pre2+build.2 fabric_loader_version = 0.15.11 mod_menu_version = v10.0.0-beta.1+1.21-pre.1.ec8c7ec -fabric_api_version = 0.99.2+1.21 +fabric_api_version = 0.99.4+1.21 diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index afeed3667..da01ac1ef 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -220,7 +220,7 @@ public static class Lists public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Entity Type Attack Restriction tweak"); public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List"); public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:mace, minecraft:netherite_sword, minecraft:diamond_sword, minecraft:iron_sword, minecraft:golden_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:mace, minecraft:netherite_axe, minecraft:diamond_axe, minecraft:iron_axe, minecraft:golden_axe, minecraft:stone_axe, minecraft:wooden_axe"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'' will be used when no other mapping is defined.\n'' will not trigger a weapon switch."); public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST, "The item restriction type for the Fast Block Placement tweak"); public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List"); public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of(), "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List"); diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 80f074ef6..0e8051004 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -6,7 +6,6 @@ import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; - import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.component.DataComponentTypes; @@ -38,7 +37,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; - import fi.dy.masa.malilib.gui.Message; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; @@ -428,7 +426,24 @@ public static void trySwitchToWeapon(Entity entity) private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) { - return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) && (makesMoreDamage(testedStack, previousWeapon) || matchesWeaponMapping(previousWeapon, entity) == false); + int itemWeight = 0; + + if (previousWeapon.isEmpty()) + { + return true; + } + if (testedStack.isEmpty() == false) + { + itemWeight += matchesWeaponMapping(testedStack, entity) ? 1 : -1; + itemWeight += hasTheSameOrBetterRarity(testedStack, previousWeapon) ? 1 : -1; + itemWeight += hasSameOrBetterWeaponEnchantments(testedStack, previousWeapon) ? 1 : -1; + itemWeight += makesMoreDamage(testedStack, previousWeapon) ? 1 : -1; + itemWeight -= matchesWeaponMapping(previousWeapon, entity) ? 1 : -1; + + return itemWeight > 0; + } + + return false; } private static boolean isBetterWeaponAndHasDurability(ItemStack testedStack, ItemStack previousTool, Entity entity) @@ -468,6 +483,7 @@ private static float getBaseAttackDamage(ItemStack stack) protected static boolean matchesWeaponMapping(ItemStack stack, Entity entity) { HashSet weapons = WEAPON_MAPPING.getOrDefault(entity.getType(), WEAPON_MAPPING.get(null)); + return weapons != null && weapons.contains(stack.getItem()); } @@ -518,18 +534,27 @@ public static int getEnchantmentLevel(ItemStack stack, @Nonnull RegistryKey Registry-Required method - /* - Optional> optional = MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntry(enchantment); - return optional.map(enchantmentReference -> EnchantmentHelper.getLevel(enchantmentReference, stack)).orElse(-1); - */ - return -1; } private static boolean isBetterTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { - return testedStack.isEmpty() == false && isMoreEffectiveTool(testedStack, previousTool, state); + int itemWeight = 0; + + if (previousTool.isEmpty()) + { + return true; + } + if (testedStack.isEmpty() == false) + { + itemWeight += hasTheSameOrBetterRarity(testedStack, previousTool) ? 1 : -1; + itemWeight += hasSameOrBetterToolEnchantments(testedStack, previousTool) ? 1 : -1; + itemWeight += isMoreEffectiveTool(testedStack, previousTool, state) ? 1 : -1; + + return itemWeight > 0; + } + + return false; } private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemStack previousTool, BlockState state) @@ -537,15 +562,79 @@ private static boolean isBetterToolAndHasDurability(ItemStack testedStack, ItemS return hasEnoughDurability(testedStack) && isBetterTool(testedStack, previousTool, state); } + private static boolean hasTheSameOrBetterRarity(ItemStack testedStack, ItemStack previousTool) + { + return testedStack.getRarity().compareTo(previousTool.getRarity()) >= 0; + } + private static boolean isMoreEffectiveTool(ItemStack testedStack, ItemStack previousTool, BlockState state) { return getBaseBlockBreakingSpeed(testedStack, state) > getBaseBlockBreakingSpeed(previousTool, state); } + /** + * Creates a total additive value of the essential Enchantment Levels + * If one of them does not contain the same Enchantment; + * then the level should be -1, and will reduce its total weighted value by 1. + */ + private static boolean hasSameOrBetterToolEnchantments(ItemStack testedStack, ItemStack previousTool) + { + int count = 0; + + // Core Tool Enchants, where Mending has the highest weighted value + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.MENDING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.UNBREAKING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.EFFICIENCY); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.FORTUNE); + + return count >= 0; + } + + private static boolean hasSameOrBetterWeaponEnchantments(ItemStack testedStack, ItemStack previousTool) + { + int count = 0; + + // Core Weapon Enchantments, where Mending has the highest weighted value + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.MENDING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.UNBREAKING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.LOOTING); + + // Damage Dealing + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.SHARPNESS); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.SMITE); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.BANE_OF_ARTHROPODS); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.POWER); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.IMPALING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.DENSITY); + + // Support + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.SWEEPING_EDGE); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.FIRE_ASPECT); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.PUNCH); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.INFINITY); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.FLAME); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.MULTISHOT); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.QUICK_CHARGE); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.PIERCING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.RIPTIDE); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.LOYALTY); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.CHANNELING); + count += hasSameOrBetterEnchantment(testedStack, previousTool, Enchantments.BREACH); + + return count >= 0; + } + + private static int hasSameOrBetterEnchantment(ItemStack testedStack, ItemStack previous, RegistryKey enchantment) + { + return getEnchantmentLevel(testedStack, enchantment) - getEnchantmentLevel(previous, enchantment); + } + protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState state) { float speed = stack.getMiningSpeedMultiplier(state); + /* Moved to enchantments check, this will corrupt the results + if (speed > 1.0f) { int effLevel = getEnchantmentLevel(stack, Enchantments.EFFICIENCY); @@ -555,6 +644,7 @@ protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState sta speed += (effLevel * effLevel) + 1; } } + */ if (state.isToolRequired() && stack.isSuitableFor(state) == false) { @@ -733,6 +823,9 @@ private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type } } + /** + * Adds the enchantment checks for Tools or Weapons + */ private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player) { ScreenHandler containerPlayer = player.currentScreenHandler; @@ -747,6 +840,8 @@ private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, Player if ((slot.id - 36) != player.getInventory().selectedSlot && stack.isDamageable() && stack.isDamaged() && targetSlot.canInsert(stack) && getEnchantmentLevel(stack, Enchantments.MENDING) > 0) + //(hasSameOrBetterToolEnchantments(stack, targetSlot.getStack()) || + //hasSameOrBetterWeaponEnchantments(stack, targetSlot.getStack()))) { return slot.id; } @@ -952,7 +1047,7 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH if (fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false) && ItemStack.areItemsEqual(stackSlot, stackReference) && stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && - hasSameIshEnchantments(stackReference, stackSlot)) + hasSameOrBetterToolEnchantments(stackReference, stackSlot)) { return slot.id; } @@ -961,6 +1056,7 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH return -1; } + /* Replaced by new function private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) { int level = getEnchantmentLevel(stackReference, Enchantments.SILK_TOUCH); @@ -979,6 +1075,7 @@ private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStac return true; } + */ private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bdcdfb8d6..f516603b5 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.21-beta.1", + "minecraft": ">=1.21-beta.2", "malilib": ">=0.18.999-snap" } } From 7a45bce20086a74e68b876ecd9f796c983aaa45a Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:07:02 -0400 Subject: [PATCH 109/128] Merge from 1.20.6 for Shulker Boxes not dropping fix --- .../tweakeroo/mixin/MixinGameRenderer.java | 15 +- .../mixin/MixinGameRenderer_ViewBob.java | 29 ++++ .../masa/tweakeroo/mixin/MixinItemEntity.java | 16 -- .../masa/tweakeroo/util/InventoryUtils.java | 25 --- src/main/resources/mixins.tweakeroo.json | 163 +++++++++--------- 5 files changed, 113 insertions(+), 135 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index 96da1713d..c22123eca 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -15,7 +15,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.decoration.AbstractDecorationEntity; @@ -27,13 +26,11 @@ import fi.dy.masa.tweakeroo.util.CameraUtils; import fi.dy.masa.tweakeroo.util.MiscUtils; -@Mixin(value = GameRenderer.class, priority = 999) +@Mixin(value = GameRenderer.class, priority = 1001) public abstract class MixinGameRenderer { @Shadow @Final MinecraftClient client; - @Shadow protected abstract void bobView(MatrixStack matrices, float tickDelta); - private float realYaw; private float realPitch; @@ -46,16 +43,6 @@ private void onRenderWorld(CallbackInfo ci) } } - @Redirect(method = "renderWorld", require = 0, at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) - private void disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) - { - if (Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue() == false) - { - this.bobView(matrices, tickDelta); - } - } - @Inject(method = "getFov", at = @At("HEAD"), cancellable = true) private void applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java new file mode 100644 index 000000000..fa30642f0 --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java @@ -0,0 +1,29 @@ +package fi.dy.masa.tweakeroo.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.util.math.MatrixStack; +import fi.dy.masa.tweakeroo.config.Configs; + +/** + * Separated out for Iris compatibility by adjusting the Mixin Priority + */ +@Mixin(value = GameRenderer.class, priority = 999) +public abstract class MixinGameRenderer_ViewBob +{ + @Shadow + protected abstract void bobView(MatrixStack matrices, float tickDelta); + + @Redirect(method = "renderWorld", require = 0, at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) + private void disableWorldViewBob(GameRenderer renderer, MatrixStack matrices, float tickDelta) + { + if (Configs.Disable.DISABLE_WORLD_VIEW_BOB.getBooleanValue() == false) + { + this.bobView(matrices, tickDelta); + } + } +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java index 704b9c956..fab2f59fb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemEntity.java @@ -17,7 +17,6 @@ import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.IEntityItem; -import fi.dy.masa.tweakeroo.util.InventoryUtils; @Mixin(ItemEntity.class) public abstract class MixinItemEntity extends Entity implements IEntityItem @@ -38,21 +37,6 @@ public int getPickupDelay() return this.pickupDelay; } - @Inject(method = "(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", at = @At("RETURN")) - private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) - { - if (FeatureToggle.TWEAK_SHULKERBOX_STACK_GROUND.getBooleanValue()) - { - if (stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof ShulkerBoxBlock) - { - if (InventoryUtils.cleanUpShulkerBoxNBT(stack)) - { - ((ItemEntity) (Object) this).setStack(stack); - } - } - } - } - @Inject(method = "canMerge()Z", at = @At("HEAD"), cancellable = true) private void allowStackingEmptyShulkerBoxes(CallbackInfoReturnable cir) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 0e8051004..bbb222909 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -10,7 +10,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.AttributeModifiersComponent; -import net.minecraft.component.type.ContainerComponent; import net.minecraft.component.type.ItemEnchantmentsComponent; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantments; @@ -1248,28 +1247,4 @@ public static void switchToPickedBlock() } } } - - public static boolean cleanUpShulkerBoxNBT(ItemStack stack) - { - ContainerComponent itemContainer = stack.getComponents().get(DataComponentTypes.CONTAINER); - boolean changed = false; - - if (itemContainer != null) - { - Iterator iter = itemContainer.stream().iterator(); - - while (iter.hasNext()) - { - ItemStack item = iter.next(); - - if (item.isEmpty()) - { - iter.remove(); - changed = true; - } - } - } - - return changed; - } } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index 1f80d5714..efc08787c 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -1,82 +1,85 @@ { - "required": true, - "package": "fi.dy.masa.tweakeroo.mixin", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_17", - "client": [ - "IMixinAbstractBlock", - "IMixinAbstractHorseEntity", - "IMixinAxeItem", - "IMixinChunkLightProvider", - "IMixinClientWorld", - "IMixinCommandBlockExecutor", - "IMixinShovelItem", - "IMixinSimpleOption", - "MixinAbstractClientPlayerEntity", - "MixinAbstractInventoryScreen", - "MixinAbstractSignEditScreen", - "MixinBackgroundRenderer", - "MixinBatEntity", - "MixinBeaconBlockEntityRenderer", - "MixinBlockEntityRenderDispatcher", - "MixinBlockItem", - "MixinBossBarHud", - "MixinBuiltChunk", - "MixinChatHud", - "MixinChatScreen", - "MixinChunkBuilder_BuiltChunk", - "MixinClientBossBar", - "MixinClientCommandSource", - "MixinClientPlayerEntity", - "MixinClientPlayerInteractionManager", - "MixinClientPlayNetworkHandler", - "MixinClientWorld", - "MixinClientWorld_Properties", - "MixinCloneCommand", - "MixinCommandBlockScreen", - "MixinCreativeInventoryScreen", - "MixinDimensionEffects_Nether", - "MixinEntity", - "MixinEntityRenderDispatcher", - "MixinExplosion", - "MixinFillCommand", - "MixinGameRenderer", - "MixinHeldItemRenderer", - "MixinInGameHud", - "MixinItem", - "MixinItemEntity", - "MixinItemGroup", - "MixinItemStack", - "MixinKeyboardInput", - "MixinLightingProvider", - "MixinLivingEntity", - "MixinMinecraftClient", - "MixinMobSpawnerBlockEntityRenderer", - "MixinMobSpawnerLogic", - "MixinMouse", - "MixinNetherPortalBlock", - "MixinObserverBlock", - "MixinParticleManager", - "MixinPlayerAbilities", - "MixinPlayerEntity", - "MixinRavagerEntity", - "MixinScaffoldingBlock", - "MixinSculkSensor", - "MixinServerPlayNetworkHandler", - "MixinShulkerBoxBlock", - "MixinSignBlockEntity", - "MixinSlimeBlock", - "MixinStructureBlockBlockEntity", - "MixinTeleportSpectatorMenu", - "MixinServerChunkLoadingManager", - "MixinTradeOffer", - "MixinUpdateStructureBlockC2SPacket", - "MixinWindow", - "MixinWorld", - "MixinWorldRenderer" - ], - "mixinPriority": 990, - "injectors": { - "defaultRequire": 0 - } + "required": true, + "package": "fi.dy.masa.tweakeroo.mixin", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_17", + "client": [ + "IMixinAbstractBlock", + "IMixinAbstractHorseEntity", + "IMixinAxeItem", + "IMixinChunkLightProvider", + "IMixinClientWorld", + "IMixinCommandBlockExecutor", + "IMixinShovelItem", + "IMixinSimpleOption", + "MixinAbstractClientPlayerEntity", + "MixinAbstractInventoryScreen", + "MixinAbstractSignEditScreen", + "MixinBackgroundRenderer", + "MixinBatEntity", + "MixinBeaconBlockEntityRenderer", + "MixinBlockEntityRenderDispatcher", + "MixinBlockItem", + "MixinBossBarHud", + "MixinBuiltChunk", + "MixinChatHud", + "MixinChatScreen", + "MixinChunkBuilder_BuiltChunk", + "MixinClientBossBar", + "MixinClientCommandSource", + "MixinClientPlayerEntity", + "MixinClientPlayerInteractionManager", + "MixinClientPlayNetworkHandler", + "MixinClientWorld", + "MixinClientWorld_Properties", + "MixinCloneCommand", + "MixinCommandBlockScreen", + "MixinCreativeInventoryScreen", + "MixinDimensionEffects_Nether", + "MixinEntity", + "MixinEntityRenderDispatcher", + "MixinExplosion", + "MixinFillCommand", + "MixinGameRenderer", + "MixinGameRenderer_ViewBob", + "MixinHeldItemRenderer", + "MixinInGameHud", + "MixinItem", + "MixinItemEntity", + "MixinItemGroup", + "MixinItemStack", + "MixinKeyboardInput", + "MixinLightingProvider", + "MixinLivingEntity", + "MixinMinecraftClient", + "MixinMobSpawnerBlockEntityRenderer", + "MixinMobSpawnerLogic", + "MixinMouse", + "MixinNetherPortalBlock", + "MixinObserverBlock", + "MixinParticleManager", + "MixinPlayerAbilities", + "MixinPlayerEntity", + "MixinRavagerEntity", + "MixinScaffoldingBlock", + "MixinSculkSensor", + "MixinServerPlayNetworkHandler", + "MixinShulkerBoxBlock", + "MixinSignBlockEntity", + "MixinSlimeBlock", + "MixinStructureBlockBlockEntity", + "MixinTeleportSpectatorMenu", + "MixinTradeOffer", + "MixinUpdateStructureBlockC2SPacket", + "MixinWindow", + "MixinWorld", + "MixinWorldRenderer" + ], + "mixinPriority": 990, + "injectors": { + "defaultRequire": 0 + }, + "mixins": [ + "MixinServerChunkLoadingManager" + ] } From ff913325b358ba907fc1a46972b65fefee814e80 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:02:49 -0400 Subject: [PATCH 110/128] Create jitpack.yml --- jitpack.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 000000000..33e78efd3 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: + - sdk install java 21.0.2-tem + - sdk use java 21.0.2-tem From eeac20b3df51aa61f1c4e95f3f3bd6eceddd2178 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Sun, 2 Jun 2024 15:19:41 -0400 Subject: [PATCH 111/128] Delete jitpack.yml --- jitpack.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml deleted file mode 100644 index 33e78efd3..000000000 --- a/jitpack.yml +++ /dev/null @@ -1,3 +0,0 @@ -before_install: - - sdk install java 21.0.2-tem - - sdk use java 21.0.2-tem From 15c6b0ddb3e9ae3002381c207084d93df8696904 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Tue, 4 Jun 2024 15:14:38 -0400 Subject: [PATCH 112/128] ModMenu update --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e8c676767..57f9ecc56 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,5 @@ minecraft_version = 1.21-pre2 mappings_version = 1.21-pre2+build.2 fabric_loader_version = 0.15.11 -mod_menu_version = v10.0.0-beta.1+1.21-pre.1.ec8c7ec +mod_menu_version = 11.0.0-beta.1 fabric_api_version = 0.99.4+1.21 From 381489d275ba9c902260489b51b306439c6255f4 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 5 Jun 2024 10:26:56 -0400 Subject: [PATCH 113/128] 1.21-pre3 (Was toying with the Flat Presets code) --- gradle.properties | 8 +- .../mixin/IMixinCustomizeFlatLevelScreen.java | 13 ++ .../tweakeroo/mixin/MixinPresetsScreen.java | 30 +++- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 17 +- src/main/resources/fabric.mod.json | 2 +- src/main/resources/mixins.tweakeroo.json | 167 +++++++++--------- 6 files changed, 134 insertions(+), 103 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCustomizeFlatLevelScreen.java diff --git a/gradle.properties b/gradle.properties index 57f9ecc56..a5d9a604d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,10 @@ mod_version = 0.19.999-snap malilib_version = 0.18.999-snap # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 1.21-pre2 -minecraft_version = 1.21-pre2 -mappings_version = 1.21-pre2+build.2 +minecraft_version_out = 1.21-pre3 +minecraft_version = 1.21-pre3 +mappings_version = 1.21-pre3+build.1 fabric_loader_version = 0.15.11 mod_menu_version = 11.0.0-beta.1 -fabric_api_version = 0.99.4+1.21 +fabric_api_version = 0.99.5+1.21 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCustomizeFlatLevelScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCustomizeFlatLevelScreen.java new file mode 100644 index 000000000..c14b5d4fa --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinCustomizeFlatLevelScreen.java @@ -0,0 +1,13 @@ +package fi.dy.masa.tweakeroo.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import net.minecraft.client.gui.screen.world.CreateWorldScreen; +import net.minecraft.client.gui.screen.world.CustomizeFlatLevelScreen; + +@Mixin(CustomizeFlatLevelScreen.class) +public interface IMixinCustomizeFlatLevelScreen +{ + @Accessor("parent") + CreateWorldScreen tweakeroo_getCreateWorldParent(); +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java index a8829a712..446f46aca 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java @@ -4,12 +4,17 @@ public abstract class MixinPresetsScreen { /* + @Shadow @Final private static RegistryKey BIOME_KEY; + + @Shadow @Final private CustomizeFlatLevelScreen parent; + @Inject(method = "init", at = @At("HEAD")) private void addCustomEntries(CallbackInfo ci) { if (FeatureToggle.TWEAK_CUSTOM_FLAT_PRESETS.getBooleanValue()) { int vanillaEntries = 9; + int toRemove = PRESETS.size() - vanillaEntries; if (toRemove > 0) @@ -38,6 +43,18 @@ private boolean registerPresetFromString(String str) if (matcher.matches()) { + // TODO --> I added some code here, and added the IMixinCustomizeFlatLevelScreen + GeneratorOptionsHolder generatorOptionsHolder = ((IMixinCustomizeFlatLevelScreen) this.parent).tweakeroo_getCreateWorldParent().getWorldCreator().getGeneratorOptionsHolder(); + DynamicRegistryManager.Immutable dynamicRegistryManager = generatorOptionsHolder.getCombinedRegistryManager(); + //FeatureSet featureSet = generatorOptionsHolder.dataConfiguration().enabledFeatures(); + RegistryWrapper.Impl biomeLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.BIOME); + RegistryWrapper.Impl structureLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.STRUCTURE_SET); + RegistryWrapper.Impl featuresLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE); + //RegistryWrapper.Impl blockLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.BLOCK).withFeatureFilter(featureSet); + FlatChunkGeneratorConfig defaultConfig = FlatChunkGeneratorConfig.getDefaultConfig(biomeLookup, structureLookup, featuresLookup); + //FlatChunkGeneratorConfig currentConfig = this.parent.getConfig(); + Optional> optBiomeEntry = Optional.empty(); + String name = matcher.group("name"); String blocksString = matcher.group("blocks"); String biomeName = matcher.group("biome"); @@ -48,7 +65,8 @@ private boolean registerPresetFromString(String str) try { - biome = RegistryKey.of(Registry.BIOME_KEY, new Identifier(biomeName)); + optBiomeEntry = dynamicRegistryManager.get(RegistryKeys.BIOME).getEntry(Identifier.ofVanilla(biomeName)); + biome = optBiomeEntry.flatMap(RegistryEntry.Reference::getKey).orElseThrow(); } catch (Exception ignore) {} @@ -62,7 +80,7 @@ private boolean registerPresetFromString(String str) try { - item = Registry.ITEM.get(new Identifier(iconItemName)); + item = Registries.ITEM.get(Identifier.of(iconItemName)); } catch (Exception ignore) {} @@ -72,17 +90,21 @@ private boolean registerPresetFromString(String str) return false; } - FlatChunkGeneratorLayer[] layers = MiscTweaks.parseBlockString(blocksString); + List layers = MiscTweaks.parseBlockString(blocksString); if (layers == null) { Tweakeroo.logger.error("Failed to get the layers for the flat world preset"); return false; } - //new PresetsScreen.SuperflatPresetsListWidget.SuperflatPresetEntry(null); + FlatChunkGeneratorConfig newConfig = defaultConfig.with(layers, defaultConfig.getStructureOverrides(), optBiomeEntry.orElseThrow()); + //new PresetsScreen.SuperflatPresetsListWidget.SuperflatPresetEntry(null); //addPreset(Text.translatable(name), item, biome, ImmutableSet.of(), false, false, layers); + // TODO --> This might work (Test Me) + //this.parent.setConfig(newConfig); + return true; } else diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index 66e6510bc..1f5893768 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -1,11 +1,12 @@ package fi.dy.masa.tweakeroo.tweaks; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; @@ -26,11 +27,7 @@ import fi.dy.masa.tweakeroo.Tweakeroo; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.util.CameraEntity; -import fi.dy.masa.tweakeroo.util.EntityRestriction; -import fi.dy.masa.tweakeroo.util.IMinecraftClientInvoker; -import fi.dy.masa.tweakeroo.util.InventoryUtils; -import fi.dy.masa.tweakeroo.util.PotionRestriction; +import fi.dy.masa.tweakeroo.util.*; public class MiscTweaks { @@ -255,8 +252,7 @@ private static boolean potionWarningShouldInclude(StatusEffectInstance effect) POTION_RESTRICTION.isAllowed(effect.getEffectType().value()); } - @Nullable - public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) + public static @NotNull List parseBlockString(String blockString) { List list = new ArrayList<>(); String[] strings = blockString.split(","); @@ -278,7 +274,7 @@ public static FlatChunkGeneratorLayer[] parseBlockString(String blockString) thicknessSum += layer.getThickness(); } - return list.toArray(new FlatChunkGeneratorLayer[list.size()]); + return list; } @Nullable @@ -325,10 +321,9 @@ private static FlatChunkGeneratorLayer parseLayerString(String string, int start } else { - FlatChunkGeneratorLayer layer = new FlatChunkGeneratorLayer(finalThickness, block); // FIXME 1.17 is this just not needed anymore? //layer.setStartY(startY); - return layer; + return new FlatChunkGeneratorLayer(finalThickness, block); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f516603b5..f53b261e6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.21-beta.2", + "minecraft": ">=1.21-beta.3", "malilib": ">=0.18.999-snap" } } diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index efc08787c..7529e18a4 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -1,85 +1,86 @@ { - "required": true, - "package": "fi.dy.masa.tweakeroo.mixin", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_17", - "client": [ - "IMixinAbstractBlock", - "IMixinAbstractHorseEntity", - "IMixinAxeItem", - "IMixinChunkLightProvider", - "IMixinClientWorld", - "IMixinCommandBlockExecutor", - "IMixinShovelItem", - "IMixinSimpleOption", - "MixinAbstractClientPlayerEntity", - "MixinAbstractInventoryScreen", - "MixinAbstractSignEditScreen", - "MixinBackgroundRenderer", - "MixinBatEntity", - "MixinBeaconBlockEntityRenderer", - "MixinBlockEntityRenderDispatcher", - "MixinBlockItem", - "MixinBossBarHud", - "MixinBuiltChunk", - "MixinChatHud", - "MixinChatScreen", - "MixinChunkBuilder_BuiltChunk", - "MixinClientBossBar", - "MixinClientCommandSource", - "MixinClientPlayerEntity", - "MixinClientPlayerInteractionManager", - "MixinClientPlayNetworkHandler", - "MixinClientWorld", - "MixinClientWorld_Properties", - "MixinCloneCommand", - "MixinCommandBlockScreen", - "MixinCreativeInventoryScreen", - "MixinDimensionEffects_Nether", - "MixinEntity", - "MixinEntityRenderDispatcher", - "MixinExplosion", - "MixinFillCommand", - "MixinGameRenderer", - "MixinGameRenderer_ViewBob", - "MixinHeldItemRenderer", - "MixinInGameHud", - "MixinItem", - "MixinItemEntity", - "MixinItemGroup", - "MixinItemStack", - "MixinKeyboardInput", - "MixinLightingProvider", - "MixinLivingEntity", - "MixinMinecraftClient", - "MixinMobSpawnerBlockEntityRenderer", - "MixinMobSpawnerLogic", - "MixinMouse", - "MixinNetherPortalBlock", - "MixinObserverBlock", - "MixinParticleManager", - "MixinPlayerAbilities", - "MixinPlayerEntity", - "MixinRavagerEntity", - "MixinScaffoldingBlock", - "MixinSculkSensor", - "MixinServerPlayNetworkHandler", - "MixinShulkerBoxBlock", - "MixinSignBlockEntity", - "MixinSlimeBlock", - "MixinStructureBlockBlockEntity", - "MixinTeleportSpectatorMenu", - "MixinTradeOffer", - "MixinUpdateStructureBlockC2SPacket", - "MixinWindow", - "MixinWorld", - "MixinWorldRenderer" - ], - "mixinPriority": 990, - "injectors": { - "defaultRequire": 0 - }, - "mixins": [ - "MixinServerChunkLoadingManager" - ] + "required": true, + "package": "fi.dy.masa.tweakeroo.mixin", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_17", + "client": [ + "IMixinAbstractBlock", + "IMixinAbstractHorseEntity", + "IMixinAxeItem", + "IMixinChunkLightProvider", + "IMixinClientWorld", + "IMixinCommandBlockExecutor", + "IMixinCustomizeFlatLevelScreen", + "IMixinShovelItem", + "IMixinSimpleOption", + "MixinAbstractClientPlayerEntity", + "MixinAbstractInventoryScreen", + "MixinAbstractSignEditScreen", + "MixinBackgroundRenderer", + "MixinBatEntity", + "MixinBeaconBlockEntityRenderer", + "MixinBlockEntityRenderDispatcher", + "MixinBlockItem", + "MixinBossBarHud", + "MixinBuiltChunk", + "MixinChatHud", + "MixinChatScreen", + "MixinChunkBuilder_BuiltChunk", + "MixinClientBossBar", + "MixinClientCommandSource", + "MixinClientPlayerEntity", + "MixinClientPlayerInteractionManager", + "MixinClientPlayNetworkHandler", + "MixinClientWorld", + "MixinClientWorld_Properties", + "MixinCloneCommand", + "MixinCommandBlockScreen", + "MixinCreativeInventoryScreen", + "MixinDimensionEffects_Nether", + "MixinEntity", + "MixinEntityRenderDispatcher", + "MixinExplosion", + "MixinFillCommand", + "MixinGameRenderer", + "MixinGameRenderer_ViewBob", + "MixinHeldItemRenderer", + "MixinInGameHud", + "MixinItem", + "MixinItemEntity", + "MixinItemGroup", + "MixinItemStack", + "MixinKeyboardInput", + "MixinLightingProvider", + "MixinLivingEntity", + "MixinMinecraftClient", + "MixinMobSpawnerBlockEntityRenderer", + "MixinMobSpawnerLogic", + "MixinMouse", + "MixinNetherPortalBlock", + "MixinObserverBlock", + "MixinParticleManager", + "MixinPlayerAbilities", + "MixinPlayerEntity", + "MixinRavagerEntity", + "MixinScaffoldingBlock", + "MixinSculkSensor", + "MixinServerPlayNetworkHandler", + "MixinShulkerBoxBlock", + "MixinSignBlockEntity", + "MixinSlimeBlock", + "MixinStructureBlockBlockEntity", + "MixinTeleportSpectatorMenu", + "MixinTradeOffer", + "MixinUpdateStructureBlockC2SPacket", + "MixinWindow", + "MixinWorld", + "MixinWorldRenderer" + ], + "mixinPriority": 990, + "injectors": { + "defaultRequire": 0 + }, + "mixins": [ + "MixinServerChunkLoadingManager" + ] } From 1f5b1fea97a4c1dee8bb5e905c54ba5353875f09 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko <116967773+sakura-ryoko@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:31:37 -0400 Subject: [PATCH 114/128] ItemStack.getMaxCount() fix for mod compatibility if max_stack_size is configured. --- .../fi/dy/masa/tweakeroo/mixin/MixinItemStack.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index 3e95230d1..5c8ef953b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -5,6 +5,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import fi.dy.masa.tweakeroo.util.IItemStackLimit; @@ -15,9 +17,11 @@ public abstract class MixinItemStack @Shadow public abstract Item getItem(); - @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) - public void getMaxStackSizeStackSensitive(CallbackInfoReturnable ci) + @Shadow public abstract ComponentMap getComponents(); + + @Inject(method = "getMaxCount", at = @At("RETURN"), cancellable = true) + public void getMaxStackSizeStackSensitive(CallbackInfoReturnable cir) { - ci.setReturnValue(((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this)); + cir.setReturnValue(Math.max(this.getComponents().getOrDefault(DataComponentTypes.MAX_STACK_SIZE, 1), ((IItemStackLimit) this.getItem()).getMaxStackSize((ItemStack) (Object) this))); } } From 689b9b4d18038d4942fcb822e17b366d77fb731e Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 7 Jun 2024 13:00:09 -0400 Subject: [PATCH 115/128] add jitpack --- build.gradle | 10 ++++++---- gradle.properties | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 6456cfc5b..2c6c7db57 100644 --- a/build.gradle +++ b/build.gradle @@ -9,14 +9,15 @@ repositories { // maven { url 'https://masa.dy.fi/maven' } maven { url 'https://masa.dy.fi/maven' - mavenLocal() + //mavenLocal() } maven { url 'https://maven.terraformersmc.com/releases/' - mavenLocal() + //mavenLocal() } // maven { url 'https://maven.quiltmc.org/repository/release/' } - flatDir { dirs 'libs' } + //flatDir { dirs 'libs' } + maven { url 'https://jitpack.io' } } dependencies { @@ -25,7 +26,8 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}" implementation "com.google.code.findbugs:jsr305:3.0.2" - modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version_out}:${project.malilib_version}" + //modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version_out}:${project.malilib_version}" + modImplementation "com.github.sakura-ryoko:malilib:${project.malilib_id}" // Fabric API. This is technically optional, but you probably want it anyway. //include(modApi(fabricApi.module("fabric-api-base", project.fabric_api_version))) diff --git a/gradle.properties b/gradle.properties index a5d9a604d..e8e73d734 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ mod_version = 0.19.999-snap # Required malilib version malilib_version = 0.18.999-snap +malilib_id = 50b18f79b8 # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21-pre3 From 9972ce6211dd4d16a087bff0953e99ee26671998 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 7 Jun 2024 13:05:43 -0400 Subject: [PATCH 116/128] add jitpack --- jitpack.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 000000000..33e78efd3 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: + - sdk install java 21.0.2-tem + - sdk use java 21.0.2-tem From 62a6cc61691ce187a71179da2c13dfdfe0b596fc Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 7 Jun 2024 15:01:35 -0400 Subject: [PATCH 117/128] 1.21-pre4 --- gradle.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index e8e73d734..dfbee670e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,13 +13,13 @@ mod_version = 0.19.999-snap # Required malilib version malilib_version = 0.18.999-snap -malilib_id = 50b18f79b8 +malilib_id = 960ff825c4 # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 1.21-pre3 -minecraft_version = 1.21-pre3 -mappings_version = 1.21-pre3+build.1 +minecraft_version_out = 1.21-pre4 +minecraft_version = 1.21-pre4 +mappings_version = 1.21-pre4+build.2 fabric_loader_version = 0.15.11 mod_menu_version = 11.0.0-beta.1 -fabric_api_version = 0.99.5+1.21 +fabric_api_version = 0.99.5+1.21 \ No newline at end of file From a16c5877ebd7cbac0445efbc8f172926977f3361 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Sat, 8 Jun 2024 05:07:41 -0400 Subject: [PATCH 118/128] Create build.yml --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..8dd87bb4f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + +name: build +on: [ pull_request, push ] + +jobs: + build: + strategy: + matrix: + # Use these Java versions + java: [ + 21, # Current Java LTS & minimum supported by Minecraft + ] + # and run on both Linux and Windows + os: [ ubuntu-20.04, windows-2022 ] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v2 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: capture build artifacts + if: ${{ runner.os == 'Linux' }} + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ From adbc594a7a5d2bca3ae0fec91d6735f7d8439e2b Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Mon, 10 Jun 2024 15:27:28 -0400 Subject: [PATCH 119/128] 1.21-rc1 --- gradle.properties | 14 +++++++------- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index dfbee670e..5f317f356 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,17 +9,17 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.999-snap +mod_version = 0.19.999-sakura # Required malilib version -malilib_version = 0.18.999-snap -malilib_id = 960ff825c4 +malilib_version = 0.18.999-sakura +malilib_id = eacaa4f6f4 # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 1.21-pre4 -minecraft_version = 1.21-pre4 -mappings_version = 1.21-pre4+build.2 +minecraft_version_out = 1.21-rc1 +minecraft_version = 1.21-rc1 +mappings_version = 1.21-rc1+build.1 fabric_loader_version = 0.15.11 mod_menu_version = 11.0.0-beta.1 -fabric_api_version = 0.99.5+1.21 \ No newline at end of file +fabric_api_version = 0.100.0+1.21 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f53b261e6..e09fc97ca 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.21-beta.3", - "malilib": ">=0.18.999-snap" + "minecraft": ">=1.21-rc.1", + "malilib": ">=0.18.999-sakura" } } From c604f3729bc7a000d6cab2e07bfc312d4cdd2a1a Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Mon, 10 Jun 2024 23:37:28 -0400 Subject: [PATCH 120/128] 1.21-rc1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5f317f356..c8ffc1145 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mod_version = 0.19.999-sakura # Required malilib version malilib_version = 0.18.999-sakura -malilib_id = eacaa4f6f4 +malilib_id = c73b5dccfe # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21-rc1 From 644cea3db2631dafb26da75959143deb0d85f792 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Tue, 11 Jun 2024 02:31:30 -0400 Subject: [PATCH 121/128] 1.21-rc1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c8ffc1145..023e35fb7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mod_version = 0.19.999-sakura # Required malilib version malilib_version = 0.18.999-sakura -malilib_id = c73b5dccfe +malilib_id = 2f2f0bb5e9 # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21-rc1 From e77fe8b261f9caa89eece3123967c5b4f26b3f46 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 12 Jun 2024 00:46:07 -0400 Subject: [PATCH 122/128] 1.21-rc1 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 023e35fb7..c0fbf0fdc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mod_version = 0.19.999-sakura # Required malilib version malilib_version = 0.18.999-sakura -malilib_id = 2f2f0bb5e9 +malilib_id = 22c8236df4 # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21-rc1 @@ -22,4 +22,4 @@ mappings_version = 1.21-rc1+build.1 fabric_loader_version = 0.15.11 mod_menu_version = 11.0.0-beta.1 -fabric_api_version = 0.100.0+1.21 +fabric_api_version = 0.100.1+1.21 From 6791c31986d3c2fcd888db4858df6259958d2ede Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Wed, 12 Jun 2024 13:25:59 -0400 Subject: [PATCH 123/128] resync --- gradle.properties | 2 +- .../fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c0fbf0fdc..b1f82ab6e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mod_version = 0.19.999-sakura # Required malilib version malilib_version = 0.18.999-sakura -malilib_id = 22c8236df4 +malilib_id = 660ac5ab37 # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21-rc1 diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index e55859d53..35311c096 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -67,8 +67,10 @@ private static float overrideFogStart(float original) { return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 1.6f; } + return original; } + @ModifyVariable( method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", slice = @Slice( @@ -80,6 +82,7 @@ private static float overrideFogEnd(float original) { return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 2.0f; } + return original; } */ From e46b02c92006e377fa20c11674658fd24ed96d55 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Thu, 13 Jun 2024 12:29:07 -0400 Subject: [PATCH 124/128] 1.21 --- gradle.properties | 12 ++++++------ src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index b1f82ab6e..04734cc90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,16 +9,16 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.999-sakura +mod_version = 0.19.9999-sakura.1 # Required malilib version -malilib_version = 0.18.999-sakura -malilib_id = 660ac5ab37 +malilib_version = 0.18.9999-sakura.1 +malilib_id = f8861381e3 # Minecraft, Fabric Loader and API and mappings versions -minecraft_version_out = 1.21-rc1 -minecraft_version = 1.21-rc1 -mappings_version = 1.21-rc1+build.1 +minecraft_version_out = 1.21 +minecraft_version = 1.21 +mappings_version = 1.21+build.1 fabric_loader_version = 0.15.11 mod_menu_version = 11.0.0-beta.1 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e09fc97ca..ccdc32183 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": ">=1.21-rc.1", - "malilib": ">=0.18.999-sakura" + "minecraft": ">=1.21", + "malilib": ">=0.18.9999-sakura.1" } } From 9d4ef837d1f4b96aee5bb22ceb76a0bc411856b1 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 14 Jun 2024 01:48:39 -0400 Subject: [PATCH 125/128] Disable Experimental Weapon / Tool swapping --- gradle.properties | 2 +- .../masa/tweakeroo/util/InventoryUtils.java | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 04734cc90..584624ba8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ author = masa mod_file_name = tweakeroo-fabric # Current mod version -mod_version = 0.19.9999-sakura.1 +mod_version = 0.20.999-sakura.2 # Required malilib version malilib_version = 0.18.9999-sakura.1 diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index bbb222909..c9934aa56 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -425,7 +425,7 @@ public static void trySwitchToWeapon(Entity entity) private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousWeapon, Entity entity) { - int itemWeight = 0; + //int itemWeight = 0; if (previousWeapon.isEmpty()) { @@ -433,6 +433,8 @@ private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousW } if (testedStack.isEmpty() == false) { + // TODO Experimental Code + /* itemWeight += matchesWeaponMapping(testedStack, entity) ? 1 : -1; itemWeight += hasTheSameOrBetterRarity(testedStack, previousWeapon) ? 1 : -1; itemWeight += hasSameOrBetterWeaponEnchantments(testedStack, previousWeapon) ? 1 : -1; @@ -440,6 +442,9 @@ private static boolean isBetterWeapon(ItemStack testedStack, ItemStack previousW itemWeight -= matchesWeaponMapping(previousWeapon, entity) ? 1 : -1; return itemWeight > 0; + */ + + return testedStack.isEmpty() == false && matchesWeaponMapping(testedStack, entity) && (makesMoreDamage(testedStack, previousWeapon) || matchesWeaponMapping(previousWeapon, entity) == false); } return false; @@ -538,7 +543,7 @@ public static int getEnchantmentLevel(ItemStack stack, @Nonnull RegistryKey 0; + */ + + return testedStack.isEmpty() == false && isMoreEffectiveTool(testedStack, previousTool, state); } return false; @@ -632,8 +642,6 @@ protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState sta { float speed = stack.getMiningSpeedMultiplier(state); - /* Moved to enchantments check, this will corrupt the results - if (speed > 1.0f) { int effLevel = getEnchantmentLevel(stack, Enchantments.EFFICIENCY); @@ -643,7 +651,6 @@ protected static float getBaseBlockBreakingSpeed(ItemStack stack, BlockState sta speed += (effLevel * effLevel) + 1; } } - */ if (state.isToolRequired() && stack.isSuitableFor(state) == false) { @@ -1046,7 +1053,8 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH if (fi.dy.masa.malilib.util.InventoryUtils.isRegularInventorySlot(slot.id, false) && ItemStack.areItemsEqual(stackSlot, stackReference) && stackSlot.getMaxDamage() - stackSlot.getDamage() >= minDurabilityLeft && - hasSameOrBetterToolEnchantments(stackReference, stackSlot)) + //hasSameOrBetterToolEnchantments(stackReference, stackSlot)) + hasSameIshEnchantments(stackReference, stackSlot)) { return slot.id; } @@ -1055,7 +1063,6 @@ private static int findSlotWithSuitableReplacementToolWithDurabilityLeft(ScreenH return -1; } - /* Replaced by new function private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStack stack) { int level = getEnchantmentLevel(stackReference, Enchantments.SILK_TOUCH); @@ -1074,7 +1081,6 @@ private static boolean hasSameIshEnchantments(ItemStack stackReference, ItemStac return true; } - */ private static int findSlotWithEffectiveItemWithDurabilityLeft(ScreenHandler container, BlockState state) { From 6f9952826d8ac5a84267e9bc6936a88b3b3cd326 Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Fri, 14 Jun 2024 17:53:14 -0400 Subject: [PATCH 126/128] yarn build 2, modmenu beta2, version # bump --- gradle.properties | 8 ++++---- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 584624ba8..8dcd0e5ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,14 +12,14 @@ mod_file_name = tweakeroo-fabric mod_version = 0.20.999-sakura.2 # Required malilib version -malilib_version = 0.18.9999-sakura.1 -malilib_id = f8861381e3 +malilib_version = 0.19.999-sakura.1 +malilib_id = c9b950bef7 # Minecraft, Fabric Loader and API and mappings versions minecraft_version_out = 1.21 minecraft_version = 1.21 -mappings_version = 1.21+build.1 +mappings_version = 1.21+build.2 fabric_loader_version = 0.15.11 -mod_menu_version = 11.0.0-beta.1 +mod_menu_version = 11.0.0-beta.2 fabric_api_version = 0.100.1+1.21 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ccdc32183..7090c575c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,6 +34,6 @@ "depends": { "minecraft": ">=1.21", - "malilib": ">=0.18.9999-sakura.1" + "malilib": ">=0.19.999-sakura.1" } } From b2c37992faa96bfcc245c84e45b68dafe33498ea Mon Sep 17 00:00:00 2001 From: Liyan Zhao Date: Wed, 19 Jun 2024 18:01:52 +0800 Subject: [PATCH 127/128] feat: support inventory preview on multi player server --- .../masa/tweakeroo/data/ServerDataSyncer.java | 161 ++++++++++++++++++ .../mixin/IMixinDataQueryHandler.java | 11 ++ .../mixin/MixinDataQueryHandler.java | 20 +++ .../tweakeroo/mixin/MixinMinecraftClient.java | 14 ++ .../masa/tweakeroo/renderer/RenderUtils.java | 45 ++--- src/main/resources/mixins.tweakeroo.json | 2 + 6 files changed, 233 insertions(+), 20 deletions(-) create mode 100644 src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinDataQueryHandler.java create mode 100644 src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java diff --git a/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java new file mode 100644 index 000000000..de54bae7f --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java @@ -0,0 +1,161 @@ +package fi.dy.masa.tweakeroo.data; + +import com.mojang.datafixers.util.Either; +import fi.dy.masa.tweakeroo.mixin.IMixinDataQueryHandler; +import net.minecraft.block.BlockEntityProvider; +import net.minecraft.block.BlockState; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.ChestBlockEntity; +import net.minecraft.block.enums.ChestType; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.DataQueryHandler; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.Entity; +import net.minecraft.inventory.DoubleInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.Pair; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.WorldChunk; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@SuppressWarnings("deprecation") +public class ServerDataSyncer { + public static ServerDataSyncer INSTANCE; + + /** + * key: BlockPos + * value: data, timestamp + */ + private final Map> blockCache = new HashMap<>(); + private final Map> entityCache = new HashMap<>(); + private final Map> pendingQueries = new HashMap<>(); + private final ClientWorld clientWorld; + + public ServerDataSyncer(ClientWorld world) { + this.clientWorld = Objects.requireNonNull(world); + } + + private @Nullable BlockEntity getCache(BlockPos pos) { + var data = blockCache.get(pos); + if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) { + return data.getLeft(); + } + + return null; + } + + private @Nullable Entity getCache(int networkId) { + var data = entityCache.get(networkId); + if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) { + return data.getLeft(); + } + + return null; + } + + public void handleQueryResponse(int transactionId, NbtCompound nbt) { + if (nbt == null) return; + if (pendingQueries.containsKey(transactionId)) { + Either either = pendingQueries.remove(transactionId); + either.ifLeft(pos -> { + if (!clientWorld.isChunkLoaded(pos)) return; + BlockState state = clientWorld.getBlockState(pos); + if (state.getBlock() instanceof BlockEntityProvider provider) { + var be = provider.createBlockEntity(pos, state); + if (be != null) { + be.read(nbt, clientWorld.getRegistryManager()); + blockCache.put(pos, new Pair<>(be, System.currentTimeMillis())); + } + } + }).ifRight(id -> { + Entity entity = clientWorld.getEntityById(id).getType().create(clientWorld); + if (entity != null) { + entity.readNbt(nbt); + entityCache.put(id, new Pair<>(entity, System.currentTimeMillis())); + } + }); + } + if (blockCache.size() > 30) { + blockCache.entrySet().removeIf(entry -> System.currentTimeMillis() - entry.getValue().getRight() > 1000); + } + if (entityCache.size() > 30) { + entityCache.entrySet().removeIf(entry -> System.currentTimeMillis() - entry.getValue().getRight() > 1000); + } + } + + public Inventory getBlockInventory(World world, BlockPos pos) { + if (!world.isChunkLoaded(pos)) return null; + var data = getCache(pos); + if (data instanceof Inventory inv) { + BlockState state = world.getBlockState(pos); + if (state.getBlock() instanceof ChestBlock && data instanceof ChestBlockEntity) { + ChestType type = state.get(ChestBlock.CHEST_TYPE); + + if (type != ChestType.SINGLE) { + BlockPos posAdj = pos.offset(ChestBlock.getFacing(state)); + if (!world.isChunkLoaded(posAdj)) return null; + BlockState stateAdj = world.getBlockState(posAdj); + + var dataAdj = getCache(posAdj); + if (dataAdj == null) { + syncBlockEntity(world, posAdj); + } + + if (stateAdj.getBlock() == state.getBlock() && + dataAdj instanceof ChestBlockEntity inv2 && + stateAdj.get(ChestBlock.CHEST_TYPE) != ChestType.SINGLE && + stateAdj.get(ChestBlock.FACING) == state.get(ChestBlock.FACING)) { + Inventory invRight = type == ChestType.RIGHT ? inv : inv2; + Inventory invLeft = type == ChestType.RIGHT ? inv2 : inv; + inv = new DoubleInventory(invRight, invLeft); + } + } + } + return inv; + } + + syncBlockEntity(world, pos); + return null; + } + + public void syncBlockEntity(World world, BlockPos pos) { + if (MinecraftClient.getInstance().isIntegratedServerRunning()) { + BlockEntity blockEntity = MinecraftClient.getInstance().getServer().getWorld(world.getRegistryKey()).getWorldChunk(pos).getBlockEntity(pos, WorldChunk.CreationType.CHECK); + if (blockEntity != null) { + blockCache.put(pos, new Pair<>(blockEntity, System.currentTimeMillis())); + return; + } + } + Either posEither = Either.left(pos); + if (MinecraftClient.getInstance().getNetworkHandler() != null && !pendingQueries.containsValue(posEither)) { + DataQueryHandler handler = MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler(); + handler.queryBlockNbt(pos, it -> {}); + pendingQueries.put(((IMixinDataQueryHandler) handler).currentTransactionId(), posEither); + } + } + + public void syncEntity(Entity entity) { + Either idEither = Either.right(entity.getId()); + if (MinecraftClient.getInstance().getNetworkHandler() != null && !pendingQueries.containsValue(idEither)) { + DataQueryHandler handler = MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler(); + handler.queryEntityNbt(entity.getId(), it -> {}); + pendingQueries.put(((IMixinDataQueryHandler) handler).currentTransactionId(), idEither); + } + } + + public @Nullable Entity getServerEntity(Entity entity) { + Entity serverEntity = getCache(entity.getId()); + if (serverEntity == null) { + syncEntity(entity); + return null; + } + return serverEntity; + } +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinDataQueryHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinDataQueryHandler.java new file mode 100644 index 000000000..41c6e2f05 --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinDataQueryHandler.java @@ -0,0 +1,11 @@ +package fi.dy.masa.tweakeroo.mixin; + +import net.minecraft.client.network.DataQueryHandler; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(DataQueryHandler.class) +public interface IMixinDataQueryHandler { + @Accessor("expectedTransactionId") + int currentTransactionId(); +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java new file mode 100644 index 000000000..db1608dd4 --- /dev/null +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java @@ -0,0 +1,20 @@ +package fi.dy.masa.tweakeroo.mixin; + +import fi.dy.masa.tweakeroo.data.ServerDataSyncer; +import net.minecraft.client.network.DataQueryHandler; +import net.minecraft.nbt.NbtCompound; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(DataQueryHandler.class) +public class MixinDataQueryHandler { + @Inject( + method = "handleQueryResponse", + at = @At("HEAD") + ) + private void queryResponse(int transactionId, NbtCompound nbt, CallbackInfoReturnable cir) { + ServerDataSyncer.INSTANCE.handleQueryResponse(transactionId, nbt); + } +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java index 4bbdee519..d15e443b7 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java @@ -1,5 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; +import fi.dy.masa.tweakeroo.data.ServerDataSyncer; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -130,4 +131,17 @@ private void onProcessKeybindsPre(CallbackInfo ci) } } } + + @Inject( + method = "setWorld", + at = @At("HEAD") + ) + private void onWorldChanged(ClientWorld world, CallbackInfo ci) + { + if (world == null) { + ServerDataSyncer.INSTANCE = null; + } else { + ServerDataSyncer.INSTANCE = new ServerDataSyncer(world); + } + } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 6d975718c..841d13305 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -1,10 +1,14 @@ package fi.dy.masa.tweakeroo.renderer; -import java.util.Set; import com.mojang.blaze3d.systems.RenderSystem; -import org.joml.Matrix4f; -import org.joml.Matrix4fStack; - +import fi.dy.masa.malilib.util.EntityUtils; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.data.ServerDataSyncer; +import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; +import fi.dy.masa.tweakeroo.util.MiscUtils; +import fi.dy.masa.tweakeroo.util.RayTraceUtils; +import fi.dy.masa.tweakeroo.util.SnapAimMode; import net.minecraft.block.Block; import net.minecraft.block.ShulkerBoxBlock; import net.minecraft.client.MinecraftClient; @@ -31,14 +35,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +import org.joml.Matrix4f; +import org.joml.Matrix4fStack; -import fi.dy.masa.malilib.util.EntityUtils; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; -import fi.dy.masa.tweakeroo.util.MiscUtils; -import fi.dy.masa.tweakeroo.util.RayTraceUtils; -import fi.dy.masa.tweakeroo.util.SnapAimMode; +import java.util.Set; public class RenderUtils { @@ -133,13 +133,8 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo HitResult trace = RayTraceUtils.getRayTraceFromEntity(world, cameraEntity, false); - if (trace == null) - { - return; - } - Inventory inv = null; - ShulkerBoxBlock block = null; + ShulkerBoxBlock shulkerBoxBlock = null; LivingEntity entityLivingBase = null; if (trace.getType() == HitResult.Type.BLOCK) @@ -149,14 +144,24 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo if (blockTmp instanceof ShulkerBoxBlock) { - block = (ShulkerBoxBlock) blockTmp; + shulkerBoxBlock = (ShulkerBoxBlock) blockTmp; } - inv = fi.dy.masa.malilib.util.InventoryUtils.getInventory(world, pos); + if (world instanceof ServerWorld realWorld) { + inv = fi.dy.masa.malilib.util.InventoryUtils.getInventory(realWorld, pos); + } else { + inv = ServerDataSyncer.INSTANCE.getBlockInventory(world, pos); + } } else if (trace.getType() == HitResult.Type.ENTITY) { Entity entity = ((EntityHitResult) trace).getEntity(); + if (entity.getWorld().isClient) { + Entity serverEntity = ServerDataSyncer.INSTANCE.getServerEntity(entity); + if (serverEntity != null) { + entity = serverEntity; + } + } if (entity instanceof LivingEntity) { @@ -207,7 +212,7 @@ else if (entity instanceof AbstractHorseEntity) yInv = Math.min(yInv, yCenter - 92); } - fi.dy.masa.malilib.render.RenderUtils.setShulkerboxBackgroundTintColor(block, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue()); + fi.dy.masa.malilib.render.RenderUtils.setShulkerboxBackgroundTintColor(shulkerBoxBlock, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue()); if (isHorse) { diff --git a/src/main/resources/mixins.tweakeroo.json b/src/main/resources/mixins.tweakeroo.json index 7529e18a4..700fe60b7 100644 --- a/src/main/resources/mixins.tweakeroo.json +++ b/src/main/resources/mixins.tweakeroo.json @@ -11,6 +11,7 @@ "IMixinClientWorld", "IMixinCommandBlockExecutor", "IMixinCustomizeFlatLevelScreen", + "IMixinDataQueryHandler", "IMixinShovelItem", "IMixinSimpleOption", "MixinAbstractClientPlayerEntity", @@ -36,6 +37,7 @@ "MixinCloneCommand", "MixinCommandBlockScreen", "MixinCreativeInventoryScreen", + "MixinDataQueryHandler", "MixinDimensionEffects_Nether", "MixinEntity", "MixinEntityRenderDispatcher", From 7c29698fe73bf66ec9ebc8e389c2b94601154faf Mon Sep 17 00:00:00 2001 From: Liyan Zhao Date: Wed, 19 Jun 2024 22:02:31 +0800 Subject: [PATCH 128/128] fix --- .../dy/masa/tweakeroo/data/ServerDataSyncer.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java index de54bae7f..57e0766da 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java @@ -45,6 +45,9 @@ public ServerDataSyncer(ClientWorld world) { private @Nullable BlockEntity getCache(BlockPos pos) { var data = blockCache.get(pos); if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) { + if (System.currentTimeMillis() - data.getRight() > 500) { + syncBlockEntity(clientWorld, pos); + } return data.getLeft(); } @@ -54,6 +57,9 @@ public ServerDataSyncer(ClientWorld world) { private @Nullable Entity getCache(int networkId) { var data = entityCache.get(networkId); if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) { + if (System.currentTimeMillis() - data.getRight() > 500) { + syncEntity(networkId); + } return data.getLeft(); } @@ -141,11 +147,11 @@ public void syncBlockEntity(World world, BlockPos pos) { } } - public void syncEntity(Entity entity) { - Either idEither = Either.right(entity.getId()); + public void syncEntity(int networkId) { + Either idEither = Either.right(networkId); if (MinecraftClient.getInstance().getNetworkHandler() != null && !pendingQueries.containsValue(idEither)) { DataQueryHandler handler = MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler(); - handler.queryEntityNbt(entity.getId(), it -> {}); + handler.queryEntityNbt(networkId, it -> {}); pendingQueries.put(((IMixinDataQueryHandler) handler).currentTransactionId(), idEither); } } @@ -153,7 +159,7 @@ public void syncEntity(Entity entity) { public @Nullable Entity getServerEntity(Entity entity) { Entity serverEntity = getCache(entity.getId()); if (serverEntity == null) { - syncEntity(entity); + syncEntity(entity.getId()); return null; } return serverEntity;