diff --git a/build.gradle.kts b/build.gradle.kts index a727386..1a3d66b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ plugins { id("org.polyfrost.defaults.java") id("org.polyfrost.defaults.loom") id("com.github.johnrengelman.shadow") - id("net.kyori.blossom") version "1.3.1" + id("net.kyori.blossom") version "1.3.2" id("signing") java } @@ -95,9 +95,9 @@ repositories { // Configures the libraries/dependencies for your mod. dependencies { // Adds the OneConfig library, so we can develop with it. - modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.1-alpha+") + modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.2-alpha+") - modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.1.2") + modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.2.0") // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier. if (platform.isLegacyForge) { diff --git a/gradle.properties b/gradle.properties index 8c8be33..663e6a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ mod_version = 1.6.2 mod_archives_name=Hytils Reborn # Gradle Configuration -- DO NOT TOUCH THESE VALUES. -polyfrost.defaults.loom=1 +polyfrost.defaults.loom=3 org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586..a441313 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.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# 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/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# 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 @@ -133,22 +131,29 @@ 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. + 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" && ! "$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 @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# 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" \ @@ -205,6 +214,12 @@ set -- \ 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. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..7101f8e 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,13 +41,13 @@ 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. -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 @@ -56,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 @@ -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/root.gradle.kts b/root.gradle.kts index 2b3f7b0..0234352 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -1,7 +1,7 @@ plugins { - kotlin("jvm") version "1.8.22" apply false + kotlin("jvm") version "1.9.10" apply false id("org.polyfrost.multi-version.root") - id("com.github.johnrengelman.shadow") version "7.1.2" apply false + id("com.github.johnrengelman.shadow") version "8.1.1" apply false } preprocess { diff --git a/settings.gradle.kts b/settings.gradle.kts index aa2a1b6..0195299 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,7 @@ pluginManagement { maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit } plugins { - val pgtVersion = "0.2.9" // Sets the default versions for Polyfrost Gradle Toolkit + val pgtVersion = "0.6.2" // Sets the default versions for Polyfrost Gradle Toolkit id("org.polyfrost.multi-version.root") version pgtVersion } } diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index 4d3b11a..387aec1 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -1068,6 +1068,125 @@ public class HytilsConfig extends Config { ) public static boolean silentLobby; + @Switch( + name = "Disable Stepping Sounds", + description = "Remove sounds created by stepping.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableSteppingSounds; + + @Switch( + name = "Disable Slime Sounds", + description = "Remove sounds created by slimes.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableSlimeSounds; + + @Switch( + name = "Disable Dragon Sounds", + description = "Remove sounds created by dragons.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDragonSounds; + + @Switch( + name = "Disable Wither Sounds", + description = "Remove sounds created by withers & wither skeletons.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableWitherSounds; + + @Switch( + name = "Disable Item Pickup Sounds", + description = "Remove sounds created by picking up an item.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableItemPickupSounds; + + @Switch( + name = "Disable Experience Orb Sounds", + description = "Remove sounds created by experience orbs.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableExperienceOrbSounds; + + @Switch( + name = "Disable Primed TNT Sounds", + description = "Remove sounds created by primed TNT.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisablePrimedTntSounds; + + @Switch( + name = "Disable Explosion Sounds", + description = "Remove sounds created by explosions.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableExplosionSounds; + + @Switch( + name = "Disable Delivery Man Sounds", + description = "Remove sounds created by delivery man events.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDeliveryManSounds; + + @Switch( + name = "Disable Note Block Sounds", + description = "Remove sounds created by Note Blocks.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableNoteBlockSounds; + + @Switch( + name = "Disable Firework Sounds", + description = "Remove sounds created by fireworks.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableFireworkSounds; + + @Switch( + name = "Disable Levelup Sounds", + description = "Remove sounds created by someone leveling up.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableLevelupSounds; + + @Switch( + name = "Disable Arrow Sounds", + description = "Remove sounds created by arrows.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableArrowSounds; + + @Switch( + name = "Disable Bat Sounds", + description = "Remove sounds created by bats.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableBatSounds; + + @Switch( + name = "Disable Fire Sounds", + description = "Remove sounds created by fire.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableFireSounds; + + @Switch( + name = "Disable Enderman Sounds", + description = "Remove sounds created by endermen.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableEndermanSounds; + + @Switch( + name = "Disable Door Sounds", + description = "Disable sounds caused by doors, trapdoors, and fence gates", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDoorSounds; + @Switch( name = "Remove Limbo AFK Title", description = "Remove the AFK title when you get sent to limbo for being AFK.", @@ -1197,6 +1316,14 @@ public HytilsConfig() { //addDependency("editHeightOverlay", "heightOverlay"); addDependency("manuallyEditHeightOverlay", "heightOverlay"); //addDependency("editHeightOverlay", "manuallyEditHeightOverlay"); + + Arrays.asList( + "lobbyDisableSteppingSounds", "lobbyDisableSlimeSounds", "lobbyDisableDragonSounds", "lobbyDisableWitherSounds", + "lobbyDisableItemPickupSounds", "lobbyDisableExperienceOrbSounds", "lobbyDisablePrimedTntSounds", + "lobbyDisableExplosionSounds", "lobbyDisableDeliveryManSounds", "lobbyDisableMysteryBoxSounds", + "lobbyDisableFireworkSounds", "lobbyDisableLevelupSounds", "lobbyDisableArrowSounds", "lobbyDisableBatSounds", + "lobbyDisableFireSounds", "lobbyDisableEndermanSounds", "lobbyDisableDoorSounds" + ).forEach(property -> addDependency(property, "Silent Lobby", () -> !silentLobby)); } public void hideTabulous() { diff --git a/src/main/java/org/polyfrost/hytils/handlers/game/miniwalls/MiddleBeaconMiniWalls.java b/src/main/java/org/polyfrost/hytils/handlers/game/miniwalls/MiddleBeaconMiniWalls.java index e795c51..b8d4e63 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/game/miniwalls/MiddleBeaconMiniWalls.java +++ b/src/main/java/org/polyfrost/hytils/handlers/game/miniwalls/MiddleBeaconMiniWalls.java @@ -54,6 +54,6 @@ public boolean shouldMakeBeacon() { @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { if (!shouldMakeBeacon()) return; - WaypointUtil.renderBeaconBeam(block, HytilsConfig.miniWallsMiddleBeaconColor.getRGB(), 1.0f, event.partialTicks); + WaypointUtil.renderBeaconBeam(block, HytilsConfig.miniWallsMiddleBeaconColor, event.partialTicks); } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/lobby/sound/SilentLobby.java b/src/main/java/org/polyfrost/hytils/handlers/lobby/sound/SilentLobby.java index 60abad7..3932a5c 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/lobby/sound/SilentLobby.java +++ b/src/main/java/org/polyfrost/hytils/handlers/lobby/sound/SilentLobby.java @@ -25,12 +25,85 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class SilentLobby { - @SubscribeEvent public void onSoundPlay(PlaySoundEvent event) { - if (HypixelUtils.INSTANCE.isHypixel() && !LocrawUtil.INSTANCE.isInGame() && HytilsConfig.silentLobby) { - if (!event.name.startsWith("gui.")) { + if (HypixelUtils.INSTANCE.isHypixel() && !LocrawUtil.INSTANCE.isInGame()) { + String sound = event.name; + if (HytilsConfig.silentLobby && !sound.startsWith("gui.")) { event.result = null; + } else { + /* + This code is taken from LobbySounds by Sk1er LLC under the GPL License: + https://github.com/Sk1erLLC/LobbySounds/blob/master/LICENSE + Only changes to adapt to this project have been made, as well as additions. + */ + if (sound.startsWith("step.") && HytilsConfig.lobbyDisableSteppingSounds) { + event.result = null; + } + + if (sound.startsWith("mob.slime") && HytilsConfig.lobbyDisableSlimeSounds) { + event.result = null; + } + + if (sound.startsWith("mob.enderdragon") && HytilsConfig.lobbyDisableDragonSounds) { + event.result = null; + } + + if ((sound.startsWith("mob.wither") || sound.startsWith("mob.skeleton")) && HytilsConfig.lobbyDisableWitherSounds) { + event.result = null; + } + + if (sound.equals("random.orb") && HytilsConfig.lobbyDisableExperienceOrbSounds) { + event.result = null; + } + + if (sound.equals("random.pop") && HytilsConfig.lobbyDisableItemPickupSounds) { + event.result = null; + } + + if (sound.equals("game.tnt.primed") && HytilsConfig.lobbyDisablePrimedTntSounds) { + event.result = null; + } + + if (sound.equals("random.explode") && HytilsConfig.lobbyDisableExplosionSounds) { + event.result = null; + } + + if (sound.equals("mob.chicken.plop") && HytilsConfig.lobbyDisableDeliveryManSounds) { + event.result = null; + } + + if ((sound.startsWith("note.") || sound.equals("random.click")) && HytilsConfig.lobbyDisableNoteBlockSounds) { + event.result = null; + } + + if (sound.startsWith("fireworks") && HytilsConfig.lobbyDisableFireworkSounds) { + event.result = null; + } + + if (sound.equals("random.levelup") && HytilsConfig.lobbyDisableLevelupSounds) { + event.result = null; + } + + if (sound.startsWith("mob.bat") && HytilsConfig.lobbyDisableBatSounds) { + event.result = null; + } + + if (sound.equals("fire.fire") && HytilsConfig.lobbyDisableFireSounds) { + event.result = null; + } + + if (sound.startsWith("mob.endermen") && HytilsConfig.lobbyDisableEndermanSounds) { + event.result = null; + } + + if (sound.startsWith("random.bow") && HytilsConfig.lobbyDisableArrowSounds) { + event.result = null; + } + + if (sound.startsWith("random.door") && HytilsConfig.lobbyDisableDoorSounds) { + event.result = null; + } } } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java b/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java index 609a6aa..8a4ea0c 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java +++ b/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java @@ -18,27 +18,20 @@ package org.polyfrost.hytils.handlers.render; -import cc.polyfrost.oneconfig.config.core.OneColor; import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo; import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil; -import org.polyfrost.hytils.config.HytilsConfig; -import org.polyfrost.hytils.events.TitleEvent; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.GL11; +import org.polyfrost.hytils.config.HytilsConfig; +import org.polyfrost.hytils.events.TitleEvent; +import org.polyfrost.hytils.util.WaypointUtil; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -83,92 +76,11 @@ public void onWorldRendered(RenderWorldLastEvent event) { if (entity instanceof TileEntityChest) { BlockPos pos = entity.getPos(); if (!highlightedChestPositions.contains(pos)) continue; - drawBoundingBox(event, pos); + WaypointUtil.drawBoundingBox(event, pos, HytilsConfig.highlightChestsColor); } } } - private void drawBoundingBox(RenderWorldLastEvent event, BlockPos pos) { - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); - double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * event.partialTicks; - double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * event.partialTicks; - double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * event.partialTicks; - - double x = pos.getX() - viewerX; - double y = pos.getY() - viewerY; - double z = pos.getZ() - viewerZ; - GlStateManager.disableCull(); - drawFilledBoundingBox(new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expand(0.01, 0.01, 0.01), HytilsConfig.highlightChestsColor); - GlStateManager.enableCull(); - } - - /** - * Taken from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 - * https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE - * - * @author Moulberry - */ - private void drawFilledBoundingBox(AxisAlignedBB aabb, OneColor c) { - GlStateManager.enableBlend(); - GlStateManager.disableLighting(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.disableTexture2D(); - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - - GlStateManager.color(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha() / 255f * (float) 0.8); - - //vertical - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); - tessellator.draw(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); - tessellator.draw(); - - - GlStateManager.color(c.getRed() / 255f * 0.8f, c.getGreen() / 255f * 0.8f, c.getBlue() / 255f * 0.8f, c.getAlpha() / 255f * (float) 0.8); - - //x - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); - tessellator.draw(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); - tessellator.draw(); - - - GlStateManager.color(c.getRed() / 255f * 0.9f, c.getGreen() / 255f * 0.9f, c.getBlue() / 255f * 0.9f, c.getAlpha() / 255f * (float) 0.8); - //z - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); - tessellator.draw(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); - worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); - worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - private boolean isNotSupported() { return LocrawUtil.INSTANCE.getLocrawInfo() == null || (LocrawUtil.INSTANCE.getLocrawInfo().getGameType() != LocrawInfo.GameType.SKYWARS && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() != LocrawInfo.GameType.BLITZ_SG && (LocrawUtil.INSTANCE.getLocrawInfo().getGameType() != LocrawInfo.GameType.DUELS || !LocrawUtil.INSTANCE.getLocrawInfo().getGameMode().contains("_SW_"))); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java b/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java index 030f782..2bbdcce 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java @@ -30,9 +30,8 @@ @Mixin(BossStatus.class) public abstract class BossStatusMixin_HideBossbar { - @Inject(method = "setBossStatus", at = @At("HEAD"), cancellable = true) - private static void cancelBossStatus(IBossDisplayData displayData, boolean hasColorModifierIn, CallbackInfo ci) { + private static void hytils$cancelBossStatus(IBossDisplayData displayData, boolean hasColorModifierIn, CallbackInfo ci) { if (displayData == null) return; if (HytilsConfig.lobbyBossbar && !LocrawUtil.INSTANCE.isInGame() || HytilsConfig.gameAdBossbar && displayData.getDisplayName().getFormattedText().matches(HytilsReborn.INSTANCE.getLanguageHandler().getCurrent().gameBossbarAdvertisementRegex.pattern())) ci.cancel(); diff --git a/src/main/java/org/polyfrost/hytils/mixin/CommandLimboMixin_FixCommand.java b/src/main/java/org/polyfrost/hytils/mixin/CommandLimboMixin_FixCommand.java index d2bbdb5..fee3236 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/CommandLimboMixin_FixCommand.java +++ b/src/main/java/org/polyfrost/hytils/mixin/CommandLimboMixin_FixCommand.java @@ -27,10 +27,9 @@ @Pseudo @Mixin(targets = "me.semx11.autotip.command.impl.CommandLimbo", remap = false) public class CommandLimboMixin_FixCommand { - @Dynamic("AutoTip") @ModifyConstant(method = "onCommand", constant = @Constant(stringValue = "/achat \u00a7c")) - private String fixAutotipCommand(String value) { + private String hytils$fixAutotipCommand(String value) { return "ยง"; } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java b/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java index ad3dffd..76763be 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java +++ b/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java @@ -27,18 +27,19 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; 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.CallbackInfo; @Mixin(EntityLivingBase.class) public class EntityLivingBaseMixin_MiningFatigue { - private final EntityLivingBase $this = (EntityLivingBase) (Object) this; - + @Unique + private final EntityLivingBase hytils$this = (EntityLivingBase) (Object) this; @Inject(method = "addPotionEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;onNewPotionEffect(Lnet/minecraft/potion/PotionEffect;)V")) - private void onPotionEffect(PotionEffect potioneffectIn, CallbackInfo ci) { - if (HytilsConfig.notifyMiningFatigue && potioneffectIn.getPotionID() == Potion.digSlowdown.getId() && LocrawUtil.INSTANCE.getLocrawInfo() != null && ($this instanceof EntityPlayerSP) && (!HytilsConfig.disableNotifyMiningFatigueSkyblock || !(LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.SKYBLOCK))) { + private void hytils$onPotionEffect(PotionEffect potioneffectIn, CallbackInfo ci) { + if (HytilsConfig.notifyMiningFatigue && potioneffectIn.getPotionID() == Potion.digSlowdown.getId() && LocrawUtil.INSTANCE.getLocrawInfo() != null && (hytils$this instanceof EntityPlayerSP) && (!HytilsConfig.disableNotifyMiningFatigueSkyblock || !(LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.SKYBLOCK))) { Notifications.INSTANCE.send("Hytils Reborn", "You have mining fatigue!"); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/EntityPlayerSPMixin_MessageHandling.java b/src/main/java/org/polyfrost/hytils/mixin/EntityPlayerSPMixin_MessageHandling.java index eead449..514ecc8 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/EntityPlayerSPMixin_MessageHandling.java +++ b/src/main/java/org/polyfrost/hytils/mixin/EntityPlayerSPMixin_MessageHandling.java @@ -28,7 +28,7 @@ @Mixin(EntityPlayerSP.class) public class EntityPlayerSPMixin_MessageHandling { @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true) - private void handleSentMessages(String message, CallbackInfo ci) { + private void hytils$handleSentMessages(String message, CallbackInfo ci) { if (HytilsReborn.INSTANCE.getChatHandler().handleSentMessage(message) == null) ci.cancel(); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiChatMixin_PlayAutocomplete.java b/src/main/java/org/polyfrost/hytils/mixin/GuiChatMixin_PlayAutocomplete.java index d5136fd..8f11725 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiChatMixin_PlayAutocomplete.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiChatMixin_PlayAutocomplete.java @@ -34,7 +34,7 @@ public class GuiChatMixin_PlayAutocomplete extends GuiScreen { protected GuiTextField inputField; @Redirect(method = "autocompletePlayerNames", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;printChatMessageWithOptionalDeletion(Lnet/minecraft/util/IChatComponent;I)V")) - private void redirectAutocomplete(GuiNewChat instance, IChatComponent chatComponent, int chatLineId) { + private void hytils$redirectAutocomplete(GuiNewChat instance, IChatComponent chatComponent, int chatLineId) { if (!this.inputField.getText().startsWith("/play ")) { instance.printChatMessageWithOptionalDeletion(chatComponent, 1); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameAccessor.java b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameAccessor.java index d626b41..049c098 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameAccessor.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameAccessor.java @@ -24,7 +24,6 @@ @Mixin(GuiIngame.class) public interface GuiIngameAccessor { - @Accessor("displayedTitle") void setDisplayedTitle(String title); diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java index c6753e9..e9aed38 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java @@ -31,7 +31,7 @@ @Mixin(value = GuiIngameForge.class, remap = false, priority = 990) public class GuiIngameForgeMixin_HideActionbar { @Inject(method = "renderRecordOverlay", at = @At("HEAD"), cancellable = true) - private void cancelActionBar(int width, int height, float partialTicks, CallbackInfo ci) { + private void hytils$cancelActionBar(int width, int height, float partialTicks, CallbackInfo ci) { if (HypixelUtils.INSTANCE.isHypixel() && LocrawUtil.INSTANCE.getLocrawInfo() != null && ((HytilsConfig.hideHousingActionBar && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.HOUSING) || (HytilsConfig.hideDropperActionBar && LocrawUtil.INSTANCE.getLocrawInfo().getGameMode().equals("DROPPER")))) ci.cancel(); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java index c7a9933..a726e76 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java @@ -32,7 +32,7 @@ @Mixin(value = GuiIngameForge.class, remap = false) public class GuiIngameForgeMixin_HideHotbar { @Inject(method = "renderHealth", at = @At("HEAD"), cancellable = true) - public void cancelHealthbar(int width, int height, CallbackInfo ci) { + public void hytils$cancelHealthbar(int width, int height, CallbackInfo ci) { LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); if (HytilsConfig.hideHudElements && HypixelUtils.INSTANCE.isHypixel()) { if (!LocrawUtil.INSTANCE.isInGame()) { @@ -80,7 +80,7 @@ public void cancelHealthbar(int width, int height, CallbackInfo ci) { } @Inject(method = "renderFood", at = @At("HEAD"), cancellable = true) - public void cancelFood(int width, int height, CallbackInfo ci) { + public void hytils$cancelFood(int width, int height, CallbackInfo ci) { LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); if (HytilsConfig.hideHudElements && HypixelUtils.INSTANCE.isHypixel()) { if (!LocrawUtil.INSTANCE.isInGame()) { @@ -135,7 +135,7 @@ public void cancelFood(int width, int height, CallbackInfo ci) { } @Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true) - public void cancelArmor(int width, int height, CallbackInfo ci) { + public void hytils$cancelArmor(int width, int height, CallbackInfo ci) { LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); if (HytilsConfig.hideHudElements && HypixelUtils.INSTANCE.isHypixel()) { if (!LocrawUtil.INSTANCE.isInGame()) { @@ -173,7 +173,7 @@ public void cancelArmor(int width, int height, CallbackInfo ci) { } @Inject(method = "renderAir", at = @At("HEAD"), cancellable = true) - public void cancelAir(int width, int height, CallbackInfo ci) { + public void hytils$cancelAir(int width, int height, CallbackInfo ci) { LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); if (HytilsConfig.hideHudElements && HypixelUtils.INSTANCE.isHypixel()) { if (!LocrawUtil.INSTANCE.isInGame()) { diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_TitleEvent.java b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_TitleEvent.java index 696f454..bca8520 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_TitleEvent.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_TitleEvent.java @@ -39,12 +39,12 @@ public GuiIngameForgeMixin_TitleEvent(Minecraft mcIn) { } @Redirect(method = "renderHealth", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/storage/WorldInfo;isHardcoreModeEnabled()Z", remap = true)) - private boolean isHardcore(WorldInfo instance) { + private boolean hytils$isHardcore(WorldInfo instance) { return instance.isHardcoreModeEnabled() || HytilsReborn.INSTANCE.getHardcoreStatus().shouldChangeStyle(); } @Inject(method = "renderTitle", at = @At("HEAD"), cancellable = true) - private void postTitleEvent(int l, int age, float opacity, CallbackInfo ci) { + private void hytils$postTitleEvent(int l, int age, float opacity, CallbackInfo ci) { if (HypixelUtils.INSTANCE.isHypixel()) { TitleEvent event = new TitleEvent(displayedTitle, displayedSubTitle); MinecraftForge.EVENT_BUS.post(event); diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiNewChatMixin_LocrawHider.java b/src/main/java/org/polyfrost/hytils/mixin/GuiNewChatMixin_LocrawHider.java index a55d606..f67de22 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiNewChatMixin_LocrawHider.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiNewChatMixin_LocrawHider.java @@ -28,6 +28,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; @@ -46,16 +47,17 @@ public abstract class GuiNewChatMixin_LocrawHider { @Shadow public abstract void deleteChatLine(int id); @Inject(method = "printChatMessageWithOptionalDeletion", at = @At("HEAD"), cancellable = true) - private void handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) { - handleHytilsMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci); + private void hytils$handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) { + hytils$handleHytilsMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci); } @Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true) - private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - handleHytilsMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); + private void hytils$handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + hytils$handleHytilsMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); } - private void handleHytilsMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + @Unique + private void hytils$handleHytilsMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { if (HytilsConfig.hideLocraw && HypixelUtils.INSTANCE.isHypixel() && chatComponent.getUnformattedTextForChat().startsWith("{") && chatComponent.getUnformattedTextForChat().endsWith("}")) { percentComplete = 1.0F; if (chatLineId != 0) { diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HideNPCs.java b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HideNPCs.java index 470f970..c024676 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HideNPCs.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HideNPCs.java @@ -31,7 +31,7 @@ @Mixin(GuiPlayerTabOverlay.class) public class GuiPlayerTabOverlayMixin_HideNPCs { @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/NetHandlerPlayClient;getPlayerInfoMap()Ljava/util/Collection;")) - private Collection hideNPCs(NetHandlerPlayClient instance) { + private Collection hytils$hideNPCs(NetHandlerPlayClient instance) { return NPCHandler.hideTabNpcs(instance.getPlayerInfoMap()); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HidePing.java b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HidePing.java index 8b971f5..ffe3bb2 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HidePing.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_HidePing.java @@ -29,7 +29,7 @@ @Mixin(value = GuiPlayerTabOverlay.class, priority = 990) public class GuiPlayerTabOverlayMixin_HidePing { @Inject(method = "drawPing", at = @At("HEAD"), cancellable = true) - private void checkPlayer(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn, CallbackInfo ci) { + private void hytils$checkPlayer(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn, CallbackInfo ci) { if (TabChanger.hidePing(networkPlayerInfoIn)) ci.cancel(); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_RemoveAds.java b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_RemoveAds.java index 10bcb00..3757636 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_RemoveAds.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiPlayerTabOverlayMixin_RemoveAds.java @@ -29,15 +29,14 @@ @Mixin(GuiPlayerTabOverlay.class) public class GuiPlayerTabOverlayMixin_RemoveAds { - @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;listFormattedStringToWidth(Ljava/lang/String;I)Ljava/util/List;", ordinal = 1)) - private List hideAdvertisementsInTabFooter(FontRenderer instance, String formattedFooter, int wrapWidth) { + private List hytils$hideAdvertisementsInTabFooter(FontRenderer instance, String formattedFooter, int wrapWidth) { return TabChanger.modifyFooter(instance, formattedFooter, wrapWidth); } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;listFormattedStringToWidth(Ljava/lang/String;I)Ljava/util/List;", ordinal = 0)) - private List hideAdvertisementsInTabHeader(FontRenderer instance, String formattedHeader, int wrapWidth) { + private List hytils$hideAdvertisementsInTabHeader(FontRenderer instance, String formattedHeader, int wrapWidth) { return TabChanger.modifyHeader(instance, formattedHeader, wrapWidth); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java b/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java index 1c14435..ee9c1da 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java +++ b/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java @@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack; 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; @@ -39,13 +40,14 @@ public abstract class LayerArmorBaseMixin_HideIngameArmour { public abstract ItemStack getCurrentArmor(EntityLivingBase entitylivingbaseIn, int armorSlot); @Inject(method = "renderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/layers/LayerArmorBase;getArmorModel(I)Lnet/minecraft/client/model/ModelBase;"), cancellable = true) - private void cancelArmor(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float partialTicks, float p_177182_5_, float p_177182_6_, float p_177182_7_, float scale, int armorSlot, CallbackInfo ci) { - if (shouldCancel(getCurrentArmor(entitylivingbaseIn, armorSlot)) && !entitylivingbaseIn.isInvisible()) { + private void hytils$cancelArmor(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float partialTicks, float p_177182_5_, float p_177182_6_, float p_177182_7_, float scale, int armorSlot, CallbackInfo ci) { + if (hytils$shouldCancel(getCurrentArmor(entitylivingbaseIn, armorSlot)) && !entitylivingbaseIn.isInvisible()) { ci.cancel(); } } - private static boolean shouldCancel(ItemStack itemStack) { + @Unique + private static boolean hytils$shouldCancel(ItemStack itemStack) { if (!HytilsConfig.hideArmor || itemStack == null || !HypixelUtils.INSTANCE.isHypixel()) return false; final LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); final Item item = itemStack.getItem(); diff --git a/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LeftClickInteract.java b/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LeftClickInteract.java index 5c1444e..679ae89 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LeftClickInteract.java +++ b/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LeftClickInteract.java @@ -44,7 +44,7 @@ public class MinecraftMixin_LeftClickInteract { public EntityPlayerSP thePlayer; @Redirect(method = "clickMouse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;clickBlock(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;)Z")) - private boolean captureClickBlock(PlayerControllerMP instance, BlockPos itemstack, EnumFacing block1) { + private boolean hytils$captureClickBlock(PlayerControllerMP instance, BlockPos itemstack, EnumFacing block1) { ForgeEventFactory.onPlayerInteract(thePlayer, PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, itemstack, objectMouseOver.sideHit, objectMouseOver.hitVec); return instance.clickBlock(itemstack, block1); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LimboLimiter.java b/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LimboLimiter.java index 4af5d5b..a01545d 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LimboLimiter.java +++ b/src/main/java/org/polyfrost/hytils/mixin/MinecraftMixin_LimboLimiter.java @@ -28,9 +28,8 @@ @Mixin(Minecraft.class) public class MinecraftMixin_LimboLimiter { - @Inject(method = "getLimitFramerate", at = @At("HEAD"), cancellable = true) - private void limitFramerate(CallbackInfoReturnable cir) { + private void hytils$limitFramerate(CallbackInfoReturnable cir) { if (LimboLimiter.shouldLimitFramerate()) cir.setReturnValue(HytilsConfig.limboFPS); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java b/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java index 5750446..a511b5b 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java +++ b/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java @@ -35,7 +35,7 @@ @Mixin(RenderEntityItem.class) public class RenderEntityItemMixin_UHCOverlay { @Inject(method = "func_177077_a(Lnet/minecraft/entity/item/EntityItem;DDDFLnet/minecraft/client/resources/model/IBakedModel;)I", at = @At(("TAIL"))) - public void scaleSpecialItems(EntityItem entity, double f4, double f5, double flag, float i, IBakedModel f, CallbackInfoReturnable cir) { + public void hytils$scaleSpecialItems(EntityItem entity, double f4, double f5, double flag, float i, IBakedModel f, CallbackInfoReturnable cir) { Item item = entity.getEntityItem().getItem(); LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); if (HypixelUtils.INSTANCE.isHypixel() && locraw != null && (locraw.getGameType() == LocrawInfo.GameType.UHC_CHAMPIONS || locraw.getGameType() == LocrawInfo.GameType.SPEED_UHC) && HytilsConfig.uhcOverlay) { diff --git a/src/main/java/org/polyfrost/hytils/mixin/beds/BlockModelShapesMixin.java b/src/main/java/org/polyfrost/hytils/mixin/beds/BlockModelShapesMixin.java index 02a0e8c..df6e50a 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/beds/BlockModelShapesMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/beds/BlockModelShapesMixin.java @@ -33,7 +33,7 @@ @Mixin(BlockModelShapes.class) public class BlockModelShapesMixin { @Inject(method = "getTexture", at = @At("HEAD"), cancellable = true) - private void addBedTextures(IBlockState state, CallbackInfoReturnable cir) { + private void hytils$addBedTextures(IBlockState state, CallbackInfoReturnable cir) { IBakedModel model = BedModelHook.getBedModel(state, Minecraft.getMinecraft().thePlayer.getPosition(), null); if (model != null) { cir.setReturnValue(model.getParticleTexture()); @@ -41,7 +41,7 @@ private void addBedTextures(IBlockState state, CallbackInfoReturnable cir) { + private void hytils$addBedModels(IBlockState state, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable cir) { IBakedModel model = BedModelHook.getBedModel(state, pos, cir.getReturnValue()); if (model != null) { cir.setReturnValue(model); diff --git a/src/main/java/org/polyfrost/hytils/mixin/beds/ModelLoaderMixin.java b/src/main/java/org/polyfrost/hytils/mixin/beds/ModelLoaderMixin.java index 302d62b..e2e233a 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/beds/ModelLoaderMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/beds/ModelLoaderMixin.java @@ -38,7 +38,7 @@ public class ModelLoaderMixin { private Set textures; @Inject(method = "setupModelRegistry", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureMap;loadSprites(Lnet/minecraft/client/resources/IResourceManager;Lnet/minecraft/client/renderer/texture/IIconCreator;)V"), remap = true) - private void getVariantsTextureLocations(CallbackInfoReturnable> cir) { + private void hytils$getVariantsTextureLocations(CallbackInfoReturnable> cir) { for (String color : BedLocationHandler.COLORS_REVERSE.values()) { textures.add(new ResourceLocation(BedModelHook.COLORED_BED + color)); } diff --git a/src/main/java/org/polyfrost/hytils/mixin/cosmetics/RenderEntityItemMixin.java b/src/main/java/org/polyfrost/hytils/mixin/cosmetics/RenderEntityItemMixin.java index 8ca58e0..b25e4b9 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/cosmetics/RenderEntityItemMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/cosmetics/RenderEntityItemMixin.java @@ -27,6 +27,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.*; 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.CallbackInfo; @@ -36,16 +37,17 @@ @Mixin(RenderEntityItem.class) public class RenderEntityItemMixin { @Inject(method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", at = @At("HEAD"), cancellable = true) - private void removeItemCosmetics(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { + private void hytils$removeItemCosmetics(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { ItemStack stack = entity.getEntityItem(); if (stack == null) return; if ((HytilsConfig.hideDuelsCosmetics && LocrawUtil.INSTANCE.getLocrawInfo() != null && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.DUELS) || (HytilsConfig.hideArcadeCosmetics && LocrawUtil.INSTANCE.getLocrawInfo() != null && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.ARCADE_GAMES) && LocrawUtil.INSTANCE.isInGame() && - (stack.getItem() instanceof ItemDoublePlant || stack.getItem() instanceof ItemDye || stack.getItem() instanceof ItemRecord || shouldRemove(stack.getItem().getUnlocalizedName()) || (stack.getItem() instanceof ItemBlock && (shouldRemove(((ItemBlock) stack.getItem()).block.getUnlocalizedName()) || ((ItemBlock) stack.getItem()).block instanceof BlockPumpkin)))) ci.cancel(); + (stack.getItem() instanceof ItemDoublePlant || stack.getItem() instanceof ItemDye || stack.getItem() instanceof ItemRecord || hytils$shouldRemove(stack.getItem().getUnlocalizedName()) || (stack.getItem() instanceof ItemBlock && (hytils$shouldRemove(((ItemBlock) stack.getItem()).block.getUnlocalizedName()) || ((ItemBlock) stack.getItem()).block instanceof BlockPumpkin)))) ci.cancel(); } - private boolean shouldRemove(String name) { + @Unique + private boolean hytils$shouldRemove(String name) { AtomicBoolean yes = new AtomicBoolean(); CosmeticsHandler.INSTANCE.itemCosmetics.forEach((itemName) -> { if (name.equals(itemName)) yes.set(true); diff --git a/src/main/java/org/polyfrost/hytils/mixin/cosmetics/WorldMixin.java b/src/main/java/org/polyfrost/hytils/mixin/cosmetics/WorldMixin.java index 1b0a5d8..d3d0d4d 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/cosmetics/WorldMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/cosmetics/WorldMixin.java @@ -31,9 +31,8 @@ @Mixin(World.class) public class WorldMixin { - @Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true) - private void removeParticles(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) { + private void hytils$removeParticles(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) { if ((HytilsConfig.hideDuelsCosmetics && LocrawUtil.INSTANCE.getLocrawInfo() != null && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.DUELS) || (HytilsConfig.hideArcadeCosmetics && LocrawUtil.INSTANCE.getLocrawInfo() != null && LocrawUtil.INSTANCE.getLocrawInfo().getGameType() == LocrawInfo.GameType.ARCADE_GAMES) && LocrawUtil.INSTANCE.isInGame()) { String particleName = EnumParticleTypes.getParticleFromId(particleID).getParticleName(); diff --git a/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiNewChatMixin.java b/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiNewChatMixin.java index 44692ed..d6333f2 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiNewChatMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiNewChatMixin.java @@ -30,17 +30,17 @@ @Mixin(GuiNewChat.class) public class GuiNewChatMixin { @Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/IChatComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;")) - private void beforeSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + private void hytils$beforeSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { LineSeparatorEnhancements.isSeparatingChat = true; } @Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/IChatComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;", shift = At.Shift.AFTER)) - private void afterSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + private void hytils$afterSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { LineSeparatorEnhancements.isSeparatingChat = false; } @ModifyArg(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) - private String changeText(String text) { + private String hytils$changeText(String text) { return LineSeparatorEnhancements.cleanLineSeparator(text); } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiUtilRenderComponentsMixin.java b/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiUtilRenderComponentsMixin.java index 3c8a1c7..484e1d7 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiUtilRenderComponentsMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/lineseparator/GuiUtilRenderComponentsMixin.java @@ -30,10 +30,9 @@ @Mixin(GuiUtilRenderComponents.class) public class GuiUtilRenderComponentsMixin { - @Dynamic @Redirect(method = "splitText", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 1)) - private static boolean trimLineSeparator(List list, Object obj) { + private static boolean hytils$trimLineSeparator(List list, Object obj) { boolean value = false; if (obj instanceof IChatComponent) { value = list.add((IChatComponent) obj); diff --git a/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_NoOptiFine.java b/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_NoOptiFine.java index 38a2db3..2b8eaf1 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_NoOptiFine.java +++ b/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_NoOptiFine.java @@ -37,7 +37,7 @@ @Mixin(BlockModelRenderer.class) public class BlockModelRendererMixin_NoOptiFine { @ModifyArgs(method = "renderModelAmbientOcclusionQuads", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V")) - private void modifyArgs(Args args, IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, List listQuadsIn, float[] quadBounds, BitSet boundsFlags, BlockModelRenderer.AmbientOcclusionFace aoFaceIn) { + private void hytils$modifyArgs(Args args, IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, List listQuadsIn, float[] quadBounds, BitSet boundsFlags, BlockModelRenderer.AmbientOcclusionFace aoFaceIn) { try { BlockModelRendererHook.handleHeightOverlay(args, blockAccessIn.getBlockState(blockPosIn), blockPosIn); } catch (Exception ignored) { @@ -46,7 +46,7 @@ private void modifyArgs(Args args, IBlockAccess blockAccessIn, Block blockIn, Bl } @ModifyArgs(method = "renderModelStandardQuads", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V")) - private void modifyArg2s(Args args, IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, EnumFacing faceIn, int brightnessIn, boolean ownBrightness, WorldRenderer worldRendererIn, List listQuadsIn, BitSet boundsFlags) { + private void hytils$modifyArg2s(Args args, IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, EnumFacing faceIn, int brightnessIn, boolean ownBrightness, WorldRenderer worldRendererIn, List listQuadsIn, BitSet boundsFlags) { try { BlockModelRendererHook.handleHeightOverlay(args, blockAccessIn.getBlockState(blockPosIn), blockPosIn); } catch (Exception ignored) { diff --git a/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_OptiFine.java b/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_OptiFine.java index 1840cf2..84cd456 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_OptiFine.java +++ b/src/main/java/org/polyfrost/hytils/mixin/overlay/BlockModelRendererMixin_OptiFine.java @@ -37,10 +37,9 @@ @Mixin(BlockModelRenderer.class) public class BlockModelRendererMixin_OptiFine { - @Dynamic("OptiFine implements its own version of renderModelAmbientOcclusionQuads") @ModifyArgs(method = "renderQuadsSmooth", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V", remap = true), remap = false) - private void modifyArgs(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, WorldRenderer buffer, List list, RenderEnv renderEnv) { + private void hytils$modifyArgs(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, WorldRenderer buffer, List list, RenderEnv renderEnv) { try { BlockModelRendererHook.handleHeightOverlay(args, stateIn, blockPosIn); } catch (Exception ignored) { @@ -50,7 +49,7 @@ private void modifyArgs(Args args, IBlockAccess worldIn, IBlockState stateIn, Bl @Dynamic("OptiFine implements its own version of renderModelAmbientOcclusionQuads") @ModifyArgs(method = "renderQuadsSmooth", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplierRgba(FFFFI)V", remap = false), remap = false) - private void modifyArg4s(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, WorldRenderer buffer, List list, RenderEnv renderEnv) { + private void hytils$modifyArg4s(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, WorldRenderer buffer, List list, RenderEnv renderEnv) { try { BlockModelRendererHook.handleHeightOverlay(args, stateIn, blockPosIn); } catch (Exception ignored) { @@ -60,7 +59,7 @@ private void modifyArg4s(Args args, IBlockAccess worldIn, IBlockState stateIn, B @Dynamic("OptiFine implements its own version of renderModelStandardOcclusionQuads") @ModifyArgs(method = "renderQuadsFlat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V", remap = true), remap = false) - private void modifyArg2s(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, EnumFacing face, int brightnessIn, boolean ownBrightness, WorldRenderer buffer, List list, RenderEnv renderEnv) { + private void hytils$modifyArg2s(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, EnumFacing face, int brightnessIn, boolean ownBrightness, WorldRenderer buffer, List list, RenderEnv renderEnv) { try { BlockModelRendererHook.handleHeightOverlay(args, stateIn, blockPosIn); } catch (Exception ignored) { diff --git a/src/main/java/org/polyfrost/hytils/mixin/overlay/VertexLighterFlatMixin.java b/src/main/java/org/polyfrost/hytils/mixin/overlay/VertexLighterFlatMixin.java index d274381..8bc5937 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/overlay/VertexLighterFlatMixin.java +++ b/src/main/java/org/polyfrost/hytils/mixin/overlay/VertexLighterFlatMixin.java @@ -31,6 +31,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.ModifyArgs; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @@ -42,21 +43,22 @@ public class VertexLighterFlatMixin { protected BlockInfo blockInfo; @ModifyArgs(method = "processQuad", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/model/pipeline/VertexLighterFlat;updateColor([F[FFFFFI)V")) - private void modifyArgs(Args args) { + private void hytils$modifyArgs(Args args) { if (HypixelUtils.INSTANCE.isHypixel() && HytilsConfig.heightOverlay && blockInfo.getBlock() instanceof BlockColored) { int height = HeightHandler.INSTANCE.getHeight(); if (height == -1) return; if (blockInfo.getBlockPos().getY() != (height - 1)) return; MapColor mapColor = blockInfo.getBlock().getMapColor(blockInfo.getWorld().getBlockState(blockInfo.getBlockPos())); boolean isClay = blockInfo.getBlock().getMaterial() == Material.rock; - if (!isClay || check(mapColor.colorIndex)) { + if (!isClay || hytils$check(mapColor.colorIndex)) { args.set(5, 1.0F); args.set(6, (HytilsConfig.manuallyEditHeightOverlay ? BlockHighlightConfig.colorMap.get(mapColor).get().getRGB() : DarkColorUtils.getCachedDarkColor(mapColor.colorValue))); } } } - private boolean check(int color) { + @Unique + private boolean hytils$check(int color) { switch (color) { case 18: case 25: diff --git a/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java b/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java index b8b1779..5f6e935 100644 --- a/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java +++ b/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java @@ -18,7 +18,7 @@ package org.polyfrost.hytils.util; - +import cc.polyfrost.oneconfig.config.core.OneColor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -27,21 +27,20 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; import org.lwjgl.opengl.GL11; import org.lwjgl.util.vector.Vector3f; -import java.awt.*; - /** - * Taken and adapted from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 - * https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE + * Taken and adapted from NotEnoughUpdates under GPL-3.0 + * https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/master/COPYING * @author Moulberry */ public class WaypointUtil { - private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); + private static final OneColor nameColor = new OneColor(-1); - private static void renderBeaconBeam(double x, double y, double z, int rgb, float alphaMult, float partialTicks, boolean disableDepth) { + private static void renderBeaconBeam(double x, double y, double z, OneColor color, float partialTicks, boolean disableDepth) { int height = 300; int bottomOffset = 0; int topOffset = bottomOffset + height; @@ -66,9 +65,10 @@ private static void renderBeaconBeam(double x, double y, double z, int rgb, floa double time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + (double) partialTicks; double d1 = MathHelper.func_181162_h(-time * 0.2D - (double) MathHelper.floor_double(-time * 0.1D)); - float r = ((rgb >> 16) & 0xFF) / 255f; - float g = ((rgb >> 8) & 0xFF) / 255f; - float b = (rgb & 0xFF) / 255f; + float r = ((color.getRGB() >> 16) & 0xFF) / 255f; + float g = ((color.getRGB() >> 8) & 0xFF) / 255f; + float b = (color.getRGB() & 0xFF) / 255f; + float a = ((color.getRGB() >> 24) & 0xFF) / 255f; double d2 = time * 0.025D * -1.5D; double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D; double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D; @@ -81,22 +81,22 @@ private static void renderBeaconBeam(double x, double y, double z, int rgb, floa double d14 = -1.0D + d1; double d15 = (double) (height) * 2.5D + d14; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); + worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0D, d15).color(r, g, b, a).endVertex(); worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); + worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0D, d15).color(r, g, b, a).endVertex(); + worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0D, d15).color(r, g, b, a).endVertex(); worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); + worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0D, d15).color(r, g, b, a).endVertex(); + worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0D, d15).color(r, g, b, a).endVertex(); worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); + worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0D, d15).color(r, g, b, a).endVertex(); + worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0D, d15).color(r, g, b, a).endVertex(); worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0D, d15).color(r, g, b, 1.0F * alphaMult).endVertex(); + worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0D, d15).color(r, g, b, a).endVertex(); tessellator.draw(); GlStateManager.disableCull(); @@ -104,22 +104,22 @@ private static void renderBeaconBeam(double x, double y, double z, int rgb, floa double d13 = height + d12; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F * a).endVertex(); worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F * a).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F * a).endVertex(); worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F * a).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F * a).endVertex(); worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F * a).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F * a).endVertex(); worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F * alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F * a).endVertex(); tessellator.draw(); GlStateManager.disableLighting(); @@ -129,28 +129,28 @@ private static void renderBeaconBeam(double x, double y, double z, int rgb, floa } } - private static void renderBoundingBox(double x, double y, double z, int rgb, float alphaMult, float partialTicks) { + private static void renderBoundingBox(double x, double y, double z, OneColor color, float alphaMult) { AxisAlignedBB bb = new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1); GlStateManager.disableDepth(); GlStateManager.disableCull(); GlStateManager.disableTexture2D(); - drawFilledBoundingBox(bb, 1f, new Color(rgb)); + drawFilledBoundingBox(bb, color, alphaMult); GlStateManager.enableTexture2D(); GlStateManager.enableCull(); GlStateManager.enableDepth(); } - public static void drawFilledBoundingBox(AxisAlignedBB boundingBox, float alpha, Color color) { + public static void drawFilledBoundingBox(AxisAlignedBB boundingBox, OneColor color, float alphaMult) { GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f * alpha); + GlStateManager.color(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F * alphaMult); //vertical worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -167,10 +167,10 @@ public static void drawFilledBoundingBox(AxisAlignedBB boundingBox, float alpha, tessellator.draw(); GlStateManager.color( - color.getRed() / 255f * 0.8f, - color.getGreen() / 255f * 0.8f, - color.getBlue() / 255f * 0.8f, - color.getAlpha() / 255f * alpha + color.getRed() / 255F * 0.8f, + color.getGreen() / 255F * 0.8f, + color.getBlue() / 255F * 0.8f, + color.getAlpha() / 255F * alphaMult ); //x @@ -188,10 +188,10 @@ public static void drawFilledBoundingBox(AxisAlignedBB boundingBox, float alpha, tessellator.draw(); GlStateManager.color( - color.getRed() / 255f * 0.9f, - color.getGreen() / 255f * 0.9f, - color.getBlue() / 255f * 0.9f, - color.getAlpha() / 255f * alpha + color.getRed() / 255F * 0.9F, + color.getGreen() / 255F * 0.9F, + color.getBlue() / 255F * 0.9F, + color.getAlpha() / 255F * alphaMult ); //z worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -208,7 +208,82 @@ public static void drawFilledBoundingBox(AxisAlignedBB boundingBox, float alpha, tessellator.draw(); } - public static void renderBeaconBeam(BlockPos block, int rgb, float alphaMult, float partialTicks) { + public static void drawBoundingBox(RenderWorldLastEvent event, BlockPos pos, OneColor color) { + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * event.partialTicks; + double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * event.partialTicks; + double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * event.partialTicks; + + double x = pos.getX() - viewerX; + double y = pos.getY() - viewerY; + double z = pos.getZ() - viewerZ; + GlStateManager.disableCull(); + drawFilledBoundingBox(new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expand(0.01, 0.01, 0.01), color); + GlStateManager.enableCull(); + } + + private static void drawFilledBoundingBox(AxisAlignedBB aabb, OneColor c) { + GlStateManager.enableBlend(); + GlStateManager.disableLighting(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + GlStateManager.disableTexture2D(); + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + GlStateManager.color(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, c.getAlpha() / 255F * (float) 0.8); + + //vertical + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + tessellator.draw(); + + + GlStateManager.color(c.getRed() / 255F * 0.8f, c.getGreen() / 255F * 0.8f, c.getBlue() / 255F * 0.8f, c.getAlpha() / 255F * (float) 0.8); + + //x + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + tessellator.draw(); + + + GlStateManager.color(c.getRed() / 255F * 0.9F, c.getGreen() / 255F * 0.9F, c.getBlue() / 255F * 0.9F, c.getAlpha() / 255F * (float) 0.8); + //z + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldrenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + + public static void renderBeaconBeam(BlockPos block, OneColor color, float partialTicks) { double viewerX; double viewerY; double viewerZ; @@ -224,10 +299,10 @@ public static void renderBeaconBeam(BlockPos block, int rgb, float alphaMult, fl double distSq = x * x + y * y + z * z; - WaypointUtil.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, distSq > 10 * 10); + WaypointUtil.renderBeaconBeam(x, y, z, color, partialTicks, distSq > 10 * 10); } - public static void renderBeaconBeamOrBoundingBox(BlockPos block, int rgb, float alphaMult, float partialTicks) { + public static void renderBeaconBeamOrBoundingBox(BlockPos block, OneColor color, float alphaMult, float partialTicks) { double viewerX; double viewerY; double viewerZ; @@ -244,9 +319,9 @@ public static void renderBeaconBeamOrBoundingBox(BlockPos block, int rgb, float double distSq = x * x + y * y + z * z; if (distSq > 10 * 10) { - WaypointUtil.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, true); + WaypointUtil.renderBeaconBeam(x, y, z, color, partialTicks, true); } else { - WaypointUtil.renderBoundingBox(x, y, z, rgb, 1.0f, partialTicks); + WaypointUtil.renderBoundingBox(x, y, z, color, alphaMult); } } @@ -278,7 +353,7 @@ public static void renderWayPoint(String str, Vector3f loc, float partialTicks) GlStateManager.translate(x, y, z); GlStateManager.translate(0, viewer.getEyeHeight(), 0); - renderNametag(str); + renderNametag(str, nameColor); GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); @@ -286,14 +361,14 @@ public static void renderWayPoint(String str, Vector3f loc, float partialTicks) GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - renderNametag(EnumChatFormatting.YELLOW.toString() + Math.round(dist) + "m"); + renderNametag(EnumChatFormatting.YELLOW.toString() + Math.round(dist) + "m", nameColor); GlStateManager.popMatrix(); GlStateManager.disableLighting(); } - public static void renderNametag(String str) { + public static void renderNametag(String str, OneColor textColor) { FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; float f = 1.6F; float f1 = 0.016666668F * f; @@ -306,7 +381,7 @@ public static void renderNametag(String str) { GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; @@ -327,7 +402,7 @@ public static void renderNametag(String str) { GlStateManager.enableDepth(); GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.color(textColor.getRed(), textColor.getGreen(), textColor.getBlue(), textColor.getAlpha()); GlStateManager.popMatrix(); } }