diff --git a/README.md b/README.md index c5b8c7a..132ce52 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ you would want while on Hypixel, including Colored Beds, Height Overlay, Chat Me ### General - **Auto Start** - Join Hypixel immediately once the client has loaded to the main menu. -- **Auto Queue** - Automatically queues for another game once you win or die. (This will require you to interact with the game in a way to prevent abuse) - **Auto-Complete Play Commands** - Allows tab completion of /play commands. +- **Auto Queue** - Automatically queues for another game once you win or die. (This will require you to interact with the game in a way to prevent abuse) - **Limbo Play Helper** - When a /play command is run in Limbo, this runs /l first and then the command. - **Automatically Check GEXP** - Automatically check your GEXP after you win a Hypixel game. - **Automatically Check Winstreak** - Automatically check your winstreak after you win a Hypixel game. @@ -22,11 +22,16 @@ you would want while on Hypixel, including Colored Beds, Height Overlay, Chat Me Chat ### Chat +- **Auto GG** - Send a "gg" message at the end of a game. +- **Auto GG Second Message** - Enable a secondary message to send after your first GG. +- **Casual Auto GG** - Send a "gg" message at the end of minigames/events that don't give out Karma, such as SkyBlock and The Pit events. +- **Anti GG** - Remove GG messages from chat. - **Auto GL** - Send a message 5 seconds before a Hypixel game starts. - **Anti GL** - Remove all GL messages from chat. - **Auto Friend** - Automatically accept friend requests. - **Auto Chat Report Confirm** - Automatically confirms chat reports. - **Auto Party Warp Confirm** - Automatically confirms party warps. +- **Auto Reply When AFK** - Automatically sends a reply to anyone who PMs you when you are AFK in Limbo. - **Game Status Restyle** - Replace common game status messages with a new style. - **Player Count Before Player Name** - Put the player count before the player name in game join/leave messages. - **Player Count on Player Leave** - Include the player count when players leave. @@ -48,6 +53,7 @@ you would want while on Hypixel, including Colored Beds, Height Overlay, Chat Me - **Thank Watchdog** - Compliment Watchdog when someone is banned, or a Watchdog announcement is sent. - **Shout Cooldown** - Show the amount of time remaining until /shout can be reused. - **Non Speech Cooldown** - Show the amount of time remaining until you can speak if you are a non. +- **Remove Karma Messages** - Remove Karma messages from the chat. - **Hide Locraw Messages** - Hide locraw messages in chat. - **Remove Lobby Statuses** - Remove lobby join messages from chat. - **Remove Ticket Machine Rewards** - Remove ticket machine messages from chat and only show your own. @@ -130,6 +136,24 @@ you would want while on Hypixel, including Colored Beds, Height Overlay, Chat Me - **Hide Useless Lobby Nametags** - Hides unnecessary nametags such as those that say "RIGHT CLICK" or "CLICK TO PLAY" in a lobby, as well as other useless ones. - **Hide Lobby Bossbars** - Hide the bossbar in the lobby. - **Silent Lobby** - Prevent all sounds from playing when you are in a lobby. +- **Disable Stepping Sounds** - Remove sounds created by stepping. +- **Disable Slime Sounds** - Remove sounds created by slimes. +- **Disable Dragon Sounds** - Remove sounds created by dragons. +- **Disable Wither Sounds** - Remove sounds created by withers & wither skeletons. +- **Disable Item Pickup Sounds** - Remove sounds created by picking up an item. +- **Disable Experience Orb Sounds** - Remove sounds created by experience orbs. +- **Disable Primed TNT Sounds** - Remove sounds created by primed TNT. +- **Disable Explosion Sounds** - Remove sounds created by explosions. +- **Disable Delivery Man Sounds** - Remove sounds created by delivery man events. +- **Disable Note Block Sounds** - Remove sounds created by note blocks. +- **Disable Firework Sounds** - Remove sounds created by fireworks. +- **Disable Levelup Sounds** - Remove sounds created by someone leveling up. +- **Disable Arrow Sounds** - Remove sounds created by arrows. +- **Disable Bat Sounds** - Remove sounds created by bats. +- **Disable Fire Sounds** - Remove sounds created by fire. +- **Disable Enderman Sounds** - Remove sounds created by endermen. +- **Disable Door Sounds** - Disable sounds caused by doors, trapdoors, and fence gates. +- **Disable Portal Sounds** - Disable sounds caused by nether portals. - **Remove Limbo AFK Title** - Remove the AFK title when you get sent to limbo for being AFK. - **Limbo Limiter** - While in Limbo, limit your framerate to reduce the load of the game on your computer. - **Limbo PM Ding** - While in Limbo, play the ding sound if you get a PM. Currently, Hypixel's option does not work in Limbo. diff --git a/build.gradle.kts b/build.gradle.kts index 86f7f2d..2507c0b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -106,15 +106,14 @@ dependencies { compileOnly("org.polyfrost.oneconfig:ui:1.0.0-alpha.14") modCompileOnly("org.polyfrost.oneconfig:$platform:1.0.0-alpha.14") - - 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") shade("com.github.ben-manes.caffeine:caffeine:2.9.3") // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier. if (platform.isLegacyForge) { compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT") - shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+") + shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta17") } } diff --git a/gradle.properties b/gradle.properties index 918d564..8314fcc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ mod_name = Hytils Reborn mod_id = hytils-reborn -mod_version = 1.6.2 +mod_version = 1.7.1 # Sets the name of the jar file that you put in your 'mods' folder. mod_archives_name=Hytils Reborn # Gradle Configuration -- DO NOT TOUCH THESE VALUES. -polyfrost.defaults.loom=2 +polyfrost.defaults.loom=3 org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true diff --git a/src/dummy/java/club/sk1er/lobbysounds/config/Sounds.java b/src/dummy/java/club/sk1er/lobbysounds/config/Sounds.java new file mode 100644 index 0000000..befb866 --- /dev/null +++ b/src/dummy/java/club/sk1er/lobbysounds/config/Sounds.java @@ -0,0 +1,58 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package club.sk1er.lobbysounds.config; + +public class Sounds { + + public static boolean DISABLE_SLIME_SOUNDS; + + public static boolean DISABLE_DRAGON_SOUNDS; + + public static boolean DISABLE_WITHER_SOUNDS; + + public static boolean DISABLE_ITEM_PICKUP_SOUNDS; + + public static boolean DISABLE_EXPERIENCE_SOUNDS; + + public static boolean DISABLE_TNT_PRIME_SOUNDS; + + public static boolean DISABLE_EXPLOSION_SOUNDS; + + public static boolean DISABLE_DELIVERY_MAN_SOUNDS; + + public static boolean DISABLE_NOTE_SOUNDS; + + public static boolean DISABLE_FIREWORKS_SOUNDS; + + public static boolean DISABLE_LEVELUP_SOUNDS; + + public static boolean DISABLE_STEP_SOUNDS; + + public static boolean DISABLE_ARROW_SOUNDS; + + public static boolean DISABLE_BAT_SOUNDS; + + public static boolean DISABLE_FIRE_SOUNDS; + + public static boolean DISABLE_ENDERMEN_SOUNDS; + + public void markDirty() {} + + public void writeData() {} +} diff --git a/src/dummy/java/club/sk1er/mods/autogg/AutoGG.java b/src/dummy/java/club/sk1er/mods/autogg/AutoGG.java new file mode 100644 index 0000000..e21f9c7 --- /dev/null +++ b/src/dummy/java/club/sk1er/mods/autogg/AutoGG.java @@ -0,0 +1,29 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package club.sk1er.mods.autogg; + +import club.sk1er.mods.autogg.config.AutoGGConfig; + +public class AutoGG { + public static AutoGG INSTANCE = new AutoGG(); + + public AutoGGConfig getAutoGGConfig() { + return new AutoGGConfig(); + } +} diff --git a/src/dummy/java/club/sk1er/mods/autogg/config/AutoGGConfig.java b/src/dummy/java/club/sk1er/mods/autogg/config/AutoGGConfig.java new file mode 100644 index 0000000..da715fa --- /dev/null +++ b/src/dummy/java/club/sk1er/mods/autogg/config/AutoGGConfig.java @@ -0,0 +1,72 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package club.sk1er.mods.autogg.config; + +public class AutoGGConfig { + + private boolean autoGGEnabled = true; + private boolean casualAutoGGEnabled; + private boolean antiGGEnabled; + private boolean antiKarmaEnabled; + private int autoGGDelay = 1; + private int autoGGPhrase = 0; + private boolean secondaryEnabled; + private int autoGGPhrase2 = 0; + private int secondaryDelay = 1; + + public boolean isModEnabled() { + return autoGGEnabled; + } + + public boolean isCasualAutoGGEnabled() { + return casualAutoGGEnabled; + } + + public boolean isAntiGGEnabled() { + return antiGGEnabled; + } + + public boolean isAntiKarmaEnabled() { + return antiKarmaEnabled; + } + + public int getAutoGGDelay() { + return autoGGDelay; + } + + public int getAutoGGPhrase() { + return autoGGPhrase; + } + + public boolean isSecondaryEnabled() { + return secondaryEnabled; + } + + public int getAutoGGPhrase2() { + return autoGGPhrase2; + } + + public int getSecondaryDelay() { + return secondaryDelay; + } + + public void markDirty() {} + + public void writeData() {} +} diff --git a/src/main/java/org/polyfrost/hytils/HytilsReborn.java b/src/main/java/org/polyfrost/hytils/HytilsReborn.java index 0c38262..2b3250b 100644 --- a/src/main/java/org/polyfrost/hytils/HytilsReborn.java +++ b/src/main/java/org/polyfrost/hytils/HytilsReborn.java @@ -96,6 +96,7 @@ public class HytilsReborn { public boolean isPatcher; public boolean isChatting; + public boolean isSk1erAutoGG; private boolean loadedCall; private RankType rank; diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index 2a84eda..9cef7d2 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -20,6 +20,7 @@ import org.polyfrost.oneconfig.api.config.v1.Config; import org.polyfrost.oneconfig.api.config.v1.annotations.*; +import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; import org.polyfrost.polyui.color.PolyColor; import org.polyfrost.hytils.HytilsReborn; import org.polyfrost.hytils.handlers.chat.modules.modifiers.GameStartCompactor; @@ -27,14 +28,20 @@ import com.google.common.collect.Lists; import net.minecraft.client.Minecraft; import org.apache.commons.io.FileUtils; +import org.polyfrost.polyui.unit.Units; import org.polyfrost.polyui.utils.ColorUtils; +import club.sk1er.lobbysounds.config.Sounds; +import club.sk1er.mods.autogg.AutoGG; import java.io.File; +import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Arrays; +import java.util.function.BooleanSupplier; +import java.util.function.Supplier; @SuppressWarnings("unused") public class HytilsConfig extends Config { @@ -123,6 +130,66 @@ public class HytilsConfig extends Config { // Chat + @Switch( + title = "Auto GG", + description = "Send a \"gg\" message at the end of a game.", + category = "Chat", subcategory = "Automatic" + ) + public static boolean autoGG = true; + + @Switch( + title = "Auto GG Second Message", + description = "Enable a secondary message to send after your first GG.", + category = "Chat", subcategory = "Automatic" + ) + public static boolean autoGGSecondMessage; + + @Switch( + title = "Casual Auto GG", + description = "Send a \"gg\" message at the end of minigames/events that don't give out Karma, such as SkyBlock and The Pit events.", + category = "Chat", subcategory = "Automatic" + ) + public static boolean casualAutoGG = true; + + @Switch( + title = "Anti GG", + description = "Remove GG messages from chat.", + category = "Chat", subcategory = "Automatic" + ) + public static boolean antiGG; + + @Dropdown( + title = "Auto GG First Message", + description = "Choose what message is said on game completion.", + category = "Chat", subcategory = "Automatic", + options = {"gg", "GG", "gf", "Good Game", "Good Fight", "Good Round! :D"} + ) + public static int autoGGMessage = 0; + + @Slider( + title = "Auto GG First Phrase Delay", + description = "Delay after the game ends to say the first message in seconds.", + category = "Chat", subcategory = "Automatic", + min = 0, max = 5 + ) + public static float autoGGFirstPhraseDelay = 1; + + @Dropdown( + title = "Auto GG Second Message", + description = "Send a secondary message sent after the first GG message.", + category = "Chat", subcategory = "Automatic", + options = {"Have a good day!", "<3", "AutoGG By Hytils Reborn!", "gf", "Good Fight", "Good Round", ":D", "Well played!", "wp"} + ) + public static int autoGGMessage2 = 0; + + @Slider( + title = "Auto GG Second Phrase Delay", + description = "Delay after the game ends to say the second message in seconds.", + category = "Chat", subcategory = "Automatic", + min = 0, max = 5 + ) + public static float autoGGSecondPhraseDelay = 1; + @Switch( title = "Auto GL", description = "Send a message 5 seconds before a Hypixel game starts.", @@ -166,6 +233,13 @@ public class HytilsConfig extends Config { ) public static boolean autoPartyWarpConfirm; + @Switch( + title = "Auto Reply When AFK", + description = "Automatically sends a reply to anyone who PMs you when you are AFK in Limbo.", + category = "Chat", subcategory = "Automatic" + ) + public static boolean autoReplyAfk; + @Switch( title = "Game Status Restyle", description = "Replace common game status messages with a new style.\n§eExamples:\n§a§l+ §bSteve §e(§b1§e/§b12§e)\n§c§l- §bSteve§r\n§e§l* §aGame starts in §b§l5 §aseconds.", @@ -327,6 +401,13 @@ public class HytilsConfig extends Config { ) public static boolean preventShoutingOnCooldown = true; + @Switch( + title = "Remove Karma Messages", + description = "Remove Karma messages from the chat.", + category = "Chat", subcategory = "Toggles" + ) + public static boolean hideKarmaMessages; + @Switch( title = "Hide Locraw Messages", description = "Hide locraw messages in chat (e.g {\"server\": \"something\"}).", @@ -981,6 +1062,132 @@ public class HytilsConfig extends Config { ) public static boolean silentLobby; + @Switch( + title = "Disable Stepping Sounds", + description = "Remove sounds created by stepping.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableSteppingSounds; + + @Switch( + title = "Disable Slime Sounds", + description = "Remove sounds created by slimes.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableSlimeSounds; + + @Switch( + title = "Disable Dragon Sounds", + description = "Remove sounds created by dragons.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDragonSounds; + + @Switch( + title = "Disable Wither Sounds", + description = "Remove sounds created by withers & wither skeletons.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableWitherSounds; + + @Switch( + title = "Disable Item Pickup Sounds", + description = "Remove sounds created by picking up an item.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableItemPickupSounds; + + @Switch( + title = "Disable Experience Orb Sounds", + description = "Remove sounds created by experience orbs.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableExperienceOrbSounds; + + @Switch( + title = "Disable Primed TNT Sounds", + description = "Remove sounds created by primed TNT.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisablePrimedTntSounds; + + @Switch( + title = "Disable Explosion Sounds", + description = "Remove sounds created by explosions.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableExplosionSounds; + + @Switch( + title = "Disable Delivery Man Sounds", + description = "Remove sounds created by delivery man events.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDeliveryManSounds; + + @Switch( + title = "Disable Note Block Sounds", + description = "Remove sounds created by note blocks.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableNoteBlockSounds; + + @Switch( + title = "Disable Firework Sounds", + description = "Remove sounds created by fireworks.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableFireworkSounds; + + @Switch( + title = "Disable Levelup Sounds", + description = "Remove sounds created by someone leveling up.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableLevelupSounds; + + @Switch( + title = "Disable Arrow Sounds", + description = "Remove sounds created by arrows.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableArrowSounds; + + @Switch( + title = "Disable Bat Sounds", + description = "Remove sounds created by bats.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableBatSounds; + + @Switch( + title = "Disable Fire Sounds", + description = "Remove sounds created by fire.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableFireSounds; + + @Switch( + title = "Disable Enderman Sounds", + description = "Remove sounds created by endermen.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableEndermanSounds; + + @Switch( + title = "Disable Door Sounds", + description = "Disable sounds caused by doors, trapdoors, and fence gates.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisableDoorSounds; + + @Switch( + title = "Disable Portal Sounds", + description = "Disable sounds caused by nether portals.", + category = "Lobby", subcategory = "Sounds" + ) + public static boolean lobbyDisablePortalSounds; + @Switch( title = "Remove Limbo AFK Title", description = "Remove the AFK title when you get sent to limbo for being AFK.", @@ -1031,11 +1238,159 @@ public HytilsConfig() { e.printStackTrace(); } - if (configNumber != 2) { // Config version has not been set or is outdated + Class autoGGClass = null; + try { + autoGGClass = Class.forName("club.sk1er.mods.autogg.config.AutoGGConfig"); + + HytilsReborn.INSTANCE.isSk1erAutoGG = true; + } catch (ClassNotFoundException ignored) { + } + + if (configNumber != 3) { // Config version has not been set or is outdated if (configNumber == 1) { overlayAmount = 300; } - configNumber = 2; // set this to the current config version + if (configNumber <= 2) { + if (autoGGClass != null) { + if (AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()) { + autoGG = true; + } + if (AutoGG.INSTANCE.getAutoGGConfig().isSecondaryEnabled()) { + autoGGSecondMessage = true; + } + if (AutoGG.INSTANCE.getAutoGGConfig().isCasualAutoGGEnabled()) { + casualAutoGG = true; + } + if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase() != 0) { + autoGGMessage = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase(); + } + if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGDelay() != 1) { + autoGGFirstPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGDelay(); + } + if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase2() != 0) { + autoGGMessage2 = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase2(); + } + if (AutoGG.INSTANCE.getAutoGGConfig().getSecondaryDelay() != 1) { + autoGGSecondPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getSecondaryDelay(); + } + if (AutoGG.INSTANCE.getAutoGGConfig().isAntiGGEnabled()) { + antiGG = true; + } + if (AutoGG.INSTANCE.getAutoGGConfig().isAntiKarmaEnabled()) { + hideKarmaMessages = true; + } + + try { + Field sk1erEnabled = autoGGClass.getDeclaredField("autoGGEnabled"); + sk1erEnabled.setAccessible(true); + sk1erEnabled.set(AutoGG.INSTANCE.getAutoGGConfig(), false); + + AutoGG.INSTANCE.getAutoGGConfig().markDirty(); + AutoGG.INSTANCE.getAutoGGConfig().writeData(); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + Notifications.INSTANCE.send("Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's AutoGG.", null, Units.seconds(5)); + } + + try { + Class.forName("club.sk1er.lobbysounds.config.Sounds"); + boolean modified = false; + if (Sounds.DISABLE_SLIME_SOUNDS) { + lobbyDisableSlimeSounds = true; + modified = true; + } + if (Sounds.DISABLE_DRAGON_SOUNDS) { + lobbyDisableDragonSounds = true; + modified = true; + } + if (Sounds.DISABLE_WITHER_SOUNDS) { + lobbyDisableWitherSounds = true; + modified = true; + } + if (Sounds.DISABLE_ITEM_PICKUP_SOUNDS) { + lobbyDisableItemPickupSounds = true; + modified = true; + } + if (Sounds.DISABLE_EXPERIENCE_SOUNDS) { + lobbyDisableExperienceOrbSounds = true; + modified = true; + } + if (Sounds.DISABLE_TNT_PRIME_SOUNDS) { + lobbyDisablePrimedTntSounds = true; + modified = true; + } + if (Sounds.DISABLE_EXPLOSION_SOUNDS) { + lobbyDisableExplosionSounds = true; + modified = true; + } + if (Sounds.DISABLE_DELIVERY_MAN_SOUNDS) { + lobbyDisableDeliveryManSounds = true; + modified = true; + } + if (Sounds.DISABLE_NOTE_SOUNDS) { + lobbyDisableNoteBlockSounds = true; + modified = true; + } + if (Sounds.DISABLE_FIREWORKS_SOUNDS) { + lobbyDisableFireworkSounds = true; + modified = true; + } + if (Sounds.DISABLE_LEVELUP_SOUNDS) { + lobbyDisableLevelupSounds = true; + modified = true; + } + if (Sounds.DISABLE_ARROW_SOUNDS) { + lobbyDisableArrowSounds = true; + modified = true; + } + if (Sounds.DISABLE_BAT_SOUNDS) { + lobbyDisableBatSounds = true; + modified = true; + } + if (Sounds.DISABLE_FIRE_SOUNDS) { + lobbyDisableFireSounds = true; + modified = true; + } + if (Sounds.DISABLE_ENDERMEN_SOUNDS) { + lobbyDisableEndermanSounds = true; + modified = true; + } + if (Sounds.DISABLE_STEP_SOUNDS) { + lobbyDisableSteppingSounds = true; + modified = true; + } + + if (Sounds.DISABLE_SLIME_SOUNDS && + Sounds.DISABLE_DRAGON_SOUNDS && + Sounds.DISABLE_WITHER_SOUNDS && + Sounds.DISABLE_ITEM_PICKUP_SOUNDS && + Sounds.DISABLE_EXPERIENCE_SOUNDS && + Sounds.DISABLE_TNT_PRIME_SOUNDS && + Sounds.DISABLE_EXPLOSION_SOUNDS && + Sounds.DISABLE_DELIVERY_MAN_SOUNDS && + Sounds.DISABLE_NOTE_SOUNDS && + Sounds.DISABLE_FIREWORKS_SOUNDS && + Sounds.DISABLE_LEVELUP_SOUNDS && + Sounds.DISABLE_ARROW_SOUNDS && + Sounds.DISABLE_BAT_SOUNDS && + Sounds.DISABLE_FIRE_SOUNDS && + Sounds.DISABLE_ENDERMEN_SOUNDS && + Sounds.DISABLE_STEP_SOUNDS) { + silentLobby = true; + lobbyDisableDoorSounds = true; + lobbyDisablePortalSounds = true; + } + + if (modified) { + Notifications.INSTANCE.send("Hytils Reborn", "Lobby Sounds settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's Lobby Sounds.", null, Units.seconds(5)); + } + } catch (ClassNotFoundException ignored) { + + } + } + configNumber = 3; // set this to the current config version save(); } @@ -1043,6 +1398,24 @@ public HytilsConfig() { addDependency("gexpMode", "autoGetGEXP"); + addDependency("autoGGSecondMessage", "autoGG"); + addDependency("casualAutoGG", "autoGG"); + addDependency("autoGGMessage", "autoGG"); + addDependency("autoGGFirstPhraseDelay", "autoGG"); + addDependency("autoGGMessage2", "autoGG"); + addDependency("autoGGSecondPhraseDelay", "autoGG"); + + BooleanSupplier autoGGEnabled = () -> !HytilsReborn.INSTANCE.isSk1erAutoGG || !AutoGG.INSTANCE.getAutoGGConfig().isModEnabled(); + + addDependency("autoGG", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("autoGGSecondMessage", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("casualAutoGG", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("autoGGMessage", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("autoGGFirstPhraseDelay", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("autoGGMessage2", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("autoGGSecondPhraseDelay", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("antiGG", "Sk1er's AutoGG Enabled", autoGGEnabled); + addDependency("glPhrase", "autoGL"); addDependency("guildAutoWB", "autoWB"); @@ -1101,6 +1474,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", "lobbyDisablePortalSounds" + ).forEach(property -> addDependency(property, "Silent Lobby", () -> !silentLobby)); } public void hideTabulous() { diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java b/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java index dc244a2..33a0ea9 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java @@ -49,6 +49,7 @@ public ChatHandler() { // Blockers this.registerModule(new AdBlocker()); + this.registerModule(new AntiGG()); this.registerModule(new AntiGL()); this.registerModule(new AutoWB()); this.registerModule(new BedwarsAdvertisementsRemover()); @@ -66,6 +67,7 @@ public ChatHandler() { this.registerModule(new GuildMOTD()); this.registerModule(new HotPotatoRemover()); this.registerModule(new HypeLimitReminderRemover()); + this.registerModule(new KarmaRemover()); this.registerModule(new LobbyFishingAnnouncementRemover()); this.registerModule(new LobbyStatusRemover()); this.registerModule(new MvpEmotesRemover()); @@ -94,10 +96,12 @@ public ChatHandler() { this.registerModule(new WhitePrivateMessages()); // Triggers + this.registerModule(new AutoAfkReply()); this.registerModule(new AutoChatReportConfirm()); this.registerModule(new AutoChatReportConfirm()); this.registerModule(new AutoChatSwapper()); this.registerModule(new AutoFriend()); + this.registerModule(new AutoGG()); this.registerModule(new AutoGL()); this.registerModule(new AutoPartyWarpConfirm()); this.registerModule(new AutoVictory()); diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java new file mode 100644 index 0000000..80af2b7 --- /dev/null +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java @@ -0,0 +1,45 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.polyfrost.hytils.handlers.chat.modules.blockers; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.jetbrains.annotations.NotNull; +import org.polyfrost.hytils.config.HytilsConfig; +import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; + +public class AntiGG implements ChatReceiveModule { + @Override + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); + if (getLanguage().cancelGgMessagesRegex.matcher(message).matches()) { + event.setCanceled(true); + } + } + + @Override + public boolean isEnabled() { + return HytilsConfig.antiGG; + } + + @Override + public int getPriority() { + return -3; + } +} diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java new file mode 100644 index 0000000..2119447 --- /dev/null +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java @@ -0,0 +1,45 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.polyfrost.hytils.handlers.chat.modules.blockers; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.jetbrains.annotations.NotNull; +import org.polyfrost.hytils.config.HytilsConfig; +import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; + +public class KarmaRemover implements ChatReceiveModule { + @Override + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); + if (getLanguage().chatCleanerKarmaMessagesRegex.matcher(message).matches()) { + event.setCanceled(true); + } + } + + @Override + public boolean isEnabled() { + return HytilsConfig.hideKarmaMessages; + } + + @Override + public int getPriority() { + return -1; + } +} diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java new file mode 100644 index 0000000..24b3344 --- /dev/null +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java @@ -0,0 +1,51 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.polyfrost.hytils.handlers.chat.modules.triggers; + +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.jetbrains.annotations.NotNull; +import org.polyfrost.hytils.config.HytilsConfig; +import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; +import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; +import org.polyfrost.universal.UChat; + +import java.util.regex.Matcher; + +public class AutoAfkReply implements ChatReceiveModule { + // TODO: maybe write a general afk checker for skyblock afkers, as they won't be in limbo + @Override + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + if (!"limbo".equals(HypixelUtils.getLocation().getServerName().orElse(null))) return; + String message = event.message.getUnformattedText(); + Matcher matcher = getLanguage().autoAfkReplyPatternRegex.matcher(message); + if (matcher.matches()) { + UChat.say("/msg " + matcher.group(2) + " Hey " + matcher.group(2) + ", I am currently AFK!"); + } + } + + @Override + public boolean isEnabled() { + return HytilsConfig.autoReplyAfk; + } + + @Override + public int getPriority() { + return -1; + } +} diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java index a87d917..f48da47 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java @@ -28,12 +28,6 @@ import java.util.concurrent.TimeUnit; public class AutoChatReportConfirm implements ChatReceiveModule { - - @Override - public int getPriority() { - return 3; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { if (event.message.getUnformattedText().equals(getLanguage().autoChatReportConfirm)) { @@ -46,4 +40,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { public boolean isEnabled() { return HytilsConfig.autoChatReportConfirm; } + + @Override + public int getPriority() { + return 3; + } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java index 064df5a..1b16640 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java @@ -41,12 +41,6 @@ import java.util.regex.Matcher; public class AutoChatSwapper implements ChatReceiveModule { - - @Override - public int getPriority() { - return 3; - } - @SuppressWarnings("all") @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { @@ -119,6 +113,11 @@ public boolean isEnabled() { return HytilsConfig.chatSwapper; } + @Override + public int getPriority() { + return 3; + } + public static class ChatChannelMessagePreventer { private boolean hasDetected; diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java new file mode 100644 index 0000000..23989bd --- /dev/null +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java @@ -0,0 +1,76 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.polyfrost.hytils.handlers.chat.modules.triggers; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.jetbrains.annotations.NotNull; +import org.polyfrost.hytils.HytilsReborn; +import org.polyfrost.hytils.config.HytilsConfig; +import org.polyfrost.hytils.handlers.cache.PatternHandler; +import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; +import org.polyfrost.oneconfig.utils.v1.Multithreading; +import org.polyfrost.universal.UChat; + +import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; + +public class AutoGG implements ChatReceiveModule { + private static final String[] ggMessagesOne = {"gg", "GG", "gf", "Good Game", "Good Fight", "Good Round! :D"}; + private static final String[] ggMessagesTwo = {"Have a good day!", "<3", "AutoGG By Hytils Reborn!", "gf", "Good Fight", "Good Round", ":D", "Well played!", "wp"}; + + private static String getGGMessageOne() { + return ggMessagesOne[HytilsConfig.autoGGMessage]; + } + private static String getGGMessageTwo() { + return ggMessagesTwo[HytilsConfig.autoGGMessage2]; + } + + @Override + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); + if (!hasGameEnded(message)) return; + Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageOne()), (long) (HytilsConfig.autoGGFirstPhraseDelay * 1000), TimeUnit.MILLISECONDS); + if (HytilsConfig.autoGGSecondMessage) + Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageTwo()), (long) ((HytilsConfig.autoGGSecondPhraseDelay + HytilsConfig.autoGGFirstPhraseDelay) * 1000), TimeUnit.MILLISECONDS); + } + + private boolean hasGameEnded(String message) { + if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) { + for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) { + if (triggers.matcher(message).matches()) { + return true; + } + } + } + + // TODO: UNTESTED! + return getLanguage().casualGameEndRegex.matcher(message).matches(); + } + + @Override + public boolean isEnabled() { + return HytilsConfig.autoGG && (!HytilsReborn.INSTANCE.isSk1erAutoGG || !club.sk1er.mods.autogg.AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()); // If Sk1er's AutoGG is enabled, we don't want to interfere with it. + } + + @Override + public int getPriority() { + return 3; + } +} diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java index c3e6dec..eaabb62 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java @@ -33,8 +33,12 @@ private static String getGLMessage() { } @Override - public int getPriority() { - return 3; + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim(); + if (message.contains(": ")) return; + if (message.endsWith("The game starts in 5 seconds!")) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac " + getGLMessage()); + } } @Override @@ -43,11 +47,7 @@ public boolean isEnabled() { } @Override - public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { - String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim(); - if (message.contains(": ")) return; - if (message.endsWith("The game starts in 5 seconds!")) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac " + getGLMessage()); - } + public int getPriority() { + return 3; } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java index 59c82c3..ad8c3e1 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java @@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit; public class AutoPartyWarpConfirm implements ChatReceiveModule { - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { final String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); @@ -40,12 +39,12 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { } @Override - public int getPriority() { - return 3; + public boolean isEnabled() { + return HytilsConfig.autoPartyWarpConfirm; } @Override - public boolean isEnabled() { - return HytilsConfig.autoPartyWarpConfirm; + public int getPriority() { + return 3; } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java index 2aac70c..f571366 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java @@ -37,14 +37,6 @@ public class AutoQueue implements ChatReceiveModule { private String command = null; private boolean sentCommand; - /** - * We want this to activate early so that it catches the queue message. - */ - @Override - public int getPriority() { - return -11; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { if (!HytilsConfig.autoQueue) { @@ -67,11 +59,6 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { } } - @Override - public boolean isEnabled() { - return HytilsConfig.autoQueue; - } - @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (this.command != null) { @@ -104,4 +91,17 @@ private void switchGame() { }, HytilsConfig.autoQueueDelay, TimeUnit.SECONDS); } + + @Override + public boolean isEnabled() { + return HytilsConfig.autoQueue; + } + + /** + * We want this to activate early so that it catches the queue message. + */ + @Override + public int getPriority() { + return -11; + } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java index 5b0a068..455f800 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java @@ -46,20 +46,10 @@ public AutoVictory() { MinecraftForge.EVENT_BUS.register(this); } - @Override - public int getPriority() { - return 3; - } - - @Override - public boolean isEnabled() { - return HytilsConfig.autoGetWinstreak || HytilsConfig.autoGetGEXP; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { String unformattedText = UTextComponent.Companion.stripFormatting(event.message.getUnformattedText()); - if (PatternHandler.INSTANCE.gameEnd.size() != 0) { + if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) { if (!victoryDetected) { // prevent victories being detected twice Multithreading.submit(() -> { //run this async as getting from the API normally would freeze minecraft for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) { @@ -153,4 +143,15 @@ private boolean isSupportedMode(HypixelUtils.Location location) { } return false; } + + @Override + public boolean isEnabled() { + return HytilsConfig.autoGetWinstreak || HytilsConfig.autoGetGEXP; + } + + @Override + public int getPriority() { + return 3; + } + } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java index ea1e0db..fab12d9 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java @@ -33,17 +33,6 @@ import java.util.regex.Matcher; public class AutoWB implements ChatReceiveModule { - - @Override - public int getPriority() { - return -6; - } - - @Override - public boolean isEnabled() { - return HytilsConfig.autoWB; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { String msg = event.message.getFormattedText().trim(); @@ -95,4 +84,14 @@ private String getNextMessage(String name) { return newMessage.replace("%player%", name); } } + + @Override + public boolean isEnabled() { + return HytilsConfig.autoWB; + } + + @Override + public int getPriority() { + return -6; + } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java index 472ed55..f204b55 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java @@ -27,8 +27,10 @@ public class AutoWarn implements ChatReceiveModule { @Override - public int getPriority() { - return 3; + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + if (UTextComponent.Companion.stripFormatting(event.message.getUnformattedText()).startsWith("A kick")) { + UChat.say(HytilsConfig.putInCaps ? "/pc ---------REQUEUE, I'VE BEEN KICKED!---------" : "/pc ---------I've been kicked, please requeue!---------"); + } } @Override @@ -37,9 +39,7 @@ public boolean isEnabled() { } @Override - public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { - if (UTextComponent.Companion.stripFormatting(event.message.getUnformattedText()).startsWith("A kick")) { - UChat.say(HytilsConfig.putInCaps ? "/pc ---------REQUEUE, I'VE BEEN KICKED!---------" : "/pc ---------I've been kicked, please requeue!---------"); - } + public int getPriority() { + return 3; } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java index 952f87c..64d1fb3 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java @@ -27,12 +27,6 @@ import java.util.regex.Matcher; public class GuildWelcomer implements ChatReceiveModule { - - @Override - public int getPriority() { - return 1; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { final String text = event.message.getUnformattedText(); @@ -46,4 +40,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { public boolean isEnabled() { return HytilsConfig.guildWelcomeMessage; } + + @Override + public int getPriority() { + return 1; + } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java index 002efbf..022e29a 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java @@ -30,7 +30,6 @@ import java.util.regex.Matcher; public class SilentRemoval implements ChatReceiveModule { - private static final Set silentUsers = new HashSet<>(); @Override diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java index 0423fc1..d0cc1dc 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java @@ -25,12 +25,6 @@ import org.jetbrains.annotations.NotNull; public class ThankWatchdog implements ChatReceiveModule { - - @Override - public int getPriority() { - return 3; - } - @Override public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { if (event.message.getUnformattedText().equals("[WATCHDOG ANNOUNCEMENT]") || event.message.getUnformattedText().startsWith("A player has been removed from your")) { @@ -42,4 +36,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { public boolean isEnabled() { return HytilsConfig.thankWatchdog; } + + @Override + public int getPriority() { + return 3; + } } 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 91fb85a..b4f8f67 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 @@ -51,6 +51,6 @@ public boolean shouldMakeBeacon() { @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { if (!shouldMakeBeacon()) return; - WaypointUtil.renderBeaconBeam(block, HytilsConfig.miniWallsMiddleBeaconColor.getArgb(), 1.0f, event.partialTicks); + WaypointUtil.renderBeaconBeam(block, HytilsConfig.miniWallsMiddleBeaconColor, event.partialTicks); } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java b/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java index 986df72..c15501b 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java +++ b/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java @@ -35,7 +35,9 @@ public class LanguageData { private String autoQueuePrefixGlobal = "^(?:You died! .+|YOU DIED! .+|You have been eliminated!|You won! .+|YOU WON! .+)$"; private String autoFriendPattern = "Friend request from (?.+)\\[ACCEPT] - \\[DENY] - \\[IGNORE].*"; + private String autoAfkReplyPattern = "^From (\\[.+?] )?(.+?): .+$"; + private String chatCleanerKarmaMessages = "^\\+(?\\d)+ Karma!$"; private String chatCleanerJoin = "(?:sled into|slid into|joined|spooked into) the lobby"; private String chatCleanerTicketAnnouncer = "^(?(?!You )\\w{1,16} )has found an? .+$"; private String chatCleanerSoulWellFind = "^.+ has found .+ in the Soul Well!$"; @@ -97,6 +99,8 @@ public class LanguageData { private String hypixelLevelUp = "You are now Hypixel Level (?\\d+)!"; + private String casualGameEnd = "^(?:MINOR EVENT! .+ in .+ ended|DRAGON EGG OVER! Earned [\\d,]+XP [\\d,]g clicking the egg \\d+ times|GIANT CAKE! Event ended! Cake's gone!|PIT EVENT ENDED: .+ \\[INFO\\])$"; + private String cancelGgMessages = "^(?:.* )?(?:\\[.+] )?\\w{1,16}(?: .+)?: (?:❤|gg|GG|gf|Good Game|Good Fight|Good Round! :D|Have a good day!|<3|AutoGG By Sk1er!|AutoGG By Hytils Reborn!|gf|Good Fight|Good Round|:D|Well Played!|wp)$"; private String cancelGlMessages = "(?!.+: )(gl|glhf|good luck|have a good game|autogl by sk1er)"; public String autoChatReportConfirm = "Please type /report confirm to log your report for staff review."; @@ -114,7 +118,9 @@ public class LanguageData { public Pattern autoQueuePrefixGlobalRegex; public Pattern autoFriendPatternRegex; + public Pattern autoAfkReplyPatternRegex; + public Pattern chatCleanerKarmaMessagesRegex; public Pattern chatCleanerJoinRegex; public Pattern chatCleanerTicketAnnouncerRegex; public Pattern chatCleanerSoulWellFindRegex; @@ -162,6 +168,8 @@ public class LanguageData { public Pattern hypixelLevelUpRegex; + public Pattern casualGameEndRegex; + public Pattern cancelGgMessagesRegex; public Pattern cancelGlMessagesRegex; public Pattern gameBossbarAdvertisementRegex; @@ -176,7 +184,9 @@ public void initialize() { autoQueuePrefixGlobalRegex = Pattern.compile(autoQueuePrefixGlobal); autoFriendPatternRegex = Pattern.compile(autoFriendPattern); + autoAfkReplyPatternRegex = Pattern.compile(autoAfkReplyPattern); + chatCleanerKarmaMessagesRegex = Pattern.compile(chatCleanerKarmaMessages); chatCleanerJoinRegex = Pattern.compile(chatCleanerJoin); chatCleanerTicketAnnouncerRegex = Pattern.compile(chatCleanerTicketAnnouncer); chatCleanerSoulWellFindRegex = Pattern.compile(chatCleanerSoulWellFind); @@ -224,6 +234,8 @@ public void initialize() { hypixelLevelUpRegex = Pattern.compile(hypixelLevelUp); + casualGameEndRegex = Pattern.compile(casualGameEnd); + cancelGgMessagesRegex = Pattern.compile(cancelGgMessages); cancelGlMessagesRegex = Pattern.compile(cancelGlMessages, Pattern.CASE_INSENSITIVE); gameBossbarAdvertisementRegex = Pattern.compile(gameBossbarAdvertisement); 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 3fd0cfb..df6c816 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 @@ -24,12 +24,89 @@ import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; public class SilentLobby { - @SubscribeEvent public void onSoundPlay(PlaySoundEvent event) { - if (HypixelUtils.isHypixel() && !HypixelUtils.getLocation().inGame() && HytilsConfig.silentLobby) { - if (!event.name.startsWith("gui.")) { + if (HypixelUtils.isHypixel() && !HypixelUtils.getLocation().inGame()) { + 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; + } + + if (sound.startsWith("portal.portal") && HytilsConfig.lobbyDisablePortalSounds) { + event.result = null; + } } } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/lobby/tab/TabChanger.java b/src/main/java/org/polyfrost/hytils/handlers/lobby/tab/TabChanger.java index 023f9c8..db5a317 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/lobby/tab/TabChanger.java +++ b/src/main/java/org/polyfrost/hytils/handlers/lobby/tab/TabChanger.java @@ -99,7 +99,7 @@ public static String modifyName(String name, NetworkPlayerInfo networkPlayerInfo } HypixelUtils.Location location = HypixelUtils.getLocation(); - if (HytilsConfig.hideGuildTagsInTab && name.endsWith("]") && (location.getGameType().orElse(null) != GameType.HOUSING || !location.inGame())) { + if (HytilsConfig.hideGuildTagsInTab && name.endsWith("]") && (location.getGameType().orElse(null) != GameType.HOUSING && !location.inGame())) { // trim off the guild tag // e.g. Steve §6[GUILD] name = name.substring(0, name.lastIndexOf("[") - 3); 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 93b35a3..0b09ddb 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java +++ b/src/main/java/org/polyfrost/hytils/handlers/render/ChestHighlighter.java @@ -20,25 +20,18 @@ import net.hypixel.data.type.GameType; import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; -import org.polyfrost.polyui.color.PolyColor; 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.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, PolyColor c) { - GlStateManager.enableBlend(); - GlStateManager.disableLighting(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.disableTexture2D(); - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - - GlStateManager.color(c.red() / 255f, c.green() / 255f, c.blue() / 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.red() / 255f * 0.8f, c.green() / 255f * 0.8f, c.blue() / 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.red() / 255f * 0.9f, c.green() / 255f * 0.9f, c.blue() / 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 !HypixelUtils.getLocation().getGameType().isPresent() || (HypixelUtils.getLocation().getGameType().get() != GameType.SKYWARS && HypixelUtils.getLocation().getGameType().get() != GameType.SURVIVAL_GAMES && (HypixelUtils.getLocation().getGameType().get() != GameType.DUELS || !HypixelUtils.getLocation().getMode().orElse("").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 b316a19..c67ac64 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/BossStatusMixin_HideBossbar.java @@ -30,11 +30,10 @@ @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 && !HypixelUtils.getLocation().inGame() || HytilsConfig.gameAdBossbar && displayData.getDisplayName().getFormattedText().matches(HytilsReborn.INSTANCE.getLanguageHandler().getCurrent().gameBossbarAdvertisementRegex.pattern())) + if (HytilsConfig.lobbyBossbar && HypixelUtils.isHypixel() && !HypixelUtils.getLocation().inGame() || 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 8789f93..7f1cc4b 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 org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; 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() && ($this instanceof EntityPlayerSP) && (!HytilsConfig.disableNotifyMiningFatigueSkyblock || !(HypixelUtils.getLocation().getGameType().orElse(null) == GameType.SKYBLOCK))) { + private void hytils$onPotionEffect(PotionEffect potioneffectIn, CallbackInfo ci) { + if (HytilsConfig.notifyMiningFatigue && potioneffectIn.getPotionID() == Potion.digSlowdown.getId() && (hytils$this instanceof EntityPlayerSP) && (!HytilsConfig.disableNotifyMiningFatigueSkyblock || !(HypixelUtils.getLocation().getGameType().orElse(null) == 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 5b719f0..f329738 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideActionbar.java @@ -30,7 +30,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.isHypixel() && ((HytilsConfig.hideHousingActionBar && HypixelUtils.getLocation().getGameType().orElse(null) == GameType.HOUSING) || (HytilsConfig.hideDropperActionBar && "DROPPER".equals(HypixelUtils.getLocation().getMode().orElse(null))))) 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 a35b911..2c02e58 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java +++ b/src/main/java/org/polyfrost/hytils/mixin/GuiIngameForgeMixin_HideHotbar.java @@ -31,7 +31,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) { HypixelUtils.Location location = HypixelUtils.getLocation(); if (HytilsConfig.hideHudElements && HypixelUtils.isHypixel()) { if (!location.inGame() || !location.getGameType().isPresent() || "limbo".equals(location.getServerName().orElse(null))) { @@ -77,7 +77,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) { HypixelUtils.Location location = HypixelUtils.getLocation(); if (HytilsConfig.hideHudElements && HypixelUtils.isHypixel()) { if (!location.inGame() || !location.getGameType().isPresent() || "limbo".equals(location.getServerName().orElse(null))) { @@ -130,7 +130,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) { HypixelUtils.Location location = HypixelUtils.getLocation(); if (HytilsConfig.hideHudElements && HypixelUtils.isHypixel()) { if (!location.inGame() || !location.getGameType().isPresent() || "limbo".equals(location.getServerName().orElse(null))) { @@ -166,7 +166,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) { HypixelUtils.Location location = HypixelUtils.getLocation(); if (HytilsConfig.hideHudElements && HypixelUtils.isHypixel()) { if (!location.inGame() || !location.getGameType().isPresent()) { 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 afc0ecf..9fc8c62 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.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 eadc66d..4a330f2 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,16 @@ 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) { + private void hytils$handleHytilsMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { if (HytilsConfig.hideLocraw && HypixelUtils.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 032b761..62e483d 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java +++ b/src/main/java/org/polyfrost/hytils/mixin/LayerArmorBaseMixin_HideIngameArmour.java @@ -28,6 +28,7 @@ import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; 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; @@ -38,13 +39,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.isHypixel()) return false; final HypixelUtils.Location location = HypixelUtils.getLocation(); 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 b3ed413..0d5cc25 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java +++ b/src/main/java/org/polyfrost/hytils/mixin/RenderEntityItemMixin_UHCOverlay.java @@ -34,7 +34,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(); GameType gameType = HypixelUtils.getLocation().getGameType().orElse(null); if (HypixelUtils.isHypixel() && (gameType == GameType.UHC || gameType == 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 6da5334..cddee46 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.item.*; import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; 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,15 +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 && HypixelUtils.getLocation().getGameType().orElse(null) == GameType.DUELS) || (HytilsConfig.hideArcadeCosmetics && + if ((HytilsConfig.hideDuelsCosmetics && + HypixelUtils.getLocation().getGameType().orElse(null) == GameType.DUELS) || (HytilsConfig.hideArcadeCosmetics && HypixelUtils.getLocation().getGameType().orElse(null) == GameType.ARCADE) && HypixelUtils.getLocation().inGame() && - (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 d62a1cb..4864111 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 && HypixelUtils.getLocation().getGameType().orElse(null) == GameType.DUELS) || (HytilsConfig.hideArcadeCosmetics && HypixelUtils.getLocation().getGameType().orElse(null) == GameType.ARCADE) && HypixelUtils.getLocation().inGame()) { 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 3166527..6f364e6 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.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().getArgb() : 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..4c0259b 100644 --- a/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java +++ b/src/main/java/org/polyfrost/hytils/util/WaypointUtil.java @@ -18,7 +18,6 @@ package org.polyfrost.hytils.util; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -27,21 +26,21 @@ 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.*; +import org.polyfrost.polyui.color.PolyColor; /** - * 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 PolyColor nameColor = PolyColor.WHITE; - 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, PolyColor 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.getArgb() >> 16) & 0xFF) / 255f; + float g = ((color.getArgb() >> 8) & 0xFF) / 255f; + float b = (color.getArgb() & 0xFF) / 255f; + float a = ((color.getArgb() >> 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, PolyColor 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, PolyColor 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.red() / 255F, color.green() / 255F, color.blue() / 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.red() / 255F * 0.8f, + color.green() / 255F * 0.8f, + color.blue() / 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.red() / 255F * 0.9F, + color.green() / 255F * 0.9F, + color.blue() / 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, PolyColor 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, PolyColor 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.red() / 255F, c.green() / 255F, c.blue() / 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.red() / 255F * 0.8f, c.green() / 255F * 0.8f, c.blue() / 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.red() / 255F * 0.9F, c.green() / 255F * 0.9F, c.blue() / 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, PolyColor 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, PolyColor 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, PolyColor 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.red(), textColor.green(), textColor.blue(), textColor.getAlpha()); GlStateManager.popMatrix(); } }