aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt33
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Chat.java119
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt58
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt85
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt66
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt312
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt106
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt40
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt55
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt61
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt32
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderManagerHook.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java60
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt18
-rw-r--r--src/main/resources/mixins.skyhanni.json5
51 files changed, 788 insertions, 771 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 57e23487f..eccfc78c9 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -9,11 +9,12 @@ import at.hannibal2.skyhanni.features.*;
import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper;
import at.hannibal2.skyhanni.features.bazaar.BazaarApi;
import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod;
+import at.hannibal2.skyhanni.features.bazaar.BazaarCancelledBuyOrderClipboard;
import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper;
import at.hannibal2.skyhanni.features.chat.ChatFilter;
import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages;
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter;
-import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFormatter;
+import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier;
import at.hannibal2.skyhanni.features.commands.WikiCommand;
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager;
import at.hannibal2.skyhanni.features.dungeon.*;
@@ -57,11 +58,11 @@ import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
-@Mod(modid = SkyHanniMod.MODID, version = SkyHanniMod.VERSION)
+@Mod(modid = SkyHanniMod.MODID, version = SkyHanniMod.VERSION, clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop")
public class SkyHanniMod {
public static final String MODID = "skyhanni";
- public static final String VERSION = "0.12.1";
+ public static final String VERSION = "0.13";
public static Features feature;
@@ -101,7 +102,7 @@ public class SkyHanniMod {
//features
registerEvent(new BazaarOrderHelper());
registerEvent(new ChatFilter());
- registerEvent(new PlayerChatFormatter());
+ registerEvent(new PlayerChatModifier());
registerEvent(new DungeonChatFilter());
registerEvent(new HideNotClickableItems());
registerEvent(new ItemDisplayOverlayFeatures());
@@ -158,11 +159,14 @@ public class SkyHanniMod {
registerEvent(new SlayerQuestWarning());
registerEvent(new StatsTuning());
registerEvent(new NonGodPotEffectDisplay());
- registerEvent(new HideBlazeParticles());
registerEvent(new SoopyGuessBurrow());
registerEvent(new GriffinBurrowHelper());
registerEvent(new GriffinBurrowParticleFinder());
registerEvent(new BurrowWarpHelper());
+ registerEvent(new HighlightBonzoMasks());
+ registerEvent(new DungeonLevelColor());
+ registerEvent(new BazaarCancelledBuyOrderClipboard());
+ registerEvent(new CroesusUnopenedChestTracker());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt
new file mode 100644
index 000000000..db63c0168
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt
@@ -0,0 +1,33 @@
+package at.hannibal2.skyhanni.config
+
+import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.GuiScreen
+import net.minecraftforge.fml.client.IModGuiFactory
+import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement
+import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler
+import org.lwjgl.input.Keyboard
+import java.io.IOException
+
+class ConfigGuiForgeInterop : IModGuiFactory {
+ override fun initialize(minecraft: Minecraft) {}
+ override fun mainConfigGuiClass(): Class<out GuiScreen> {
+ return WrappedSkyHanniConfig::class.java
+ }
+
+ override fun runtimeGuiCategories(): Set<RuntimeOptionCategoryElement>? = null
+
+ override fun getHandlerFor(runtimeOptionCategoryElement: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? =
+ null
+
+ class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigEditor.editor) {
+ @Throws(IOException::class)
+ override fun handleKeyboardInput() {
+ if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ Minecraft.getMinecraft().displayGuiScreen(parent)
+ return
+ }
+ super.handleKeyboardInput()
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 605606d8a..0f7f0fd6c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor;
import at.hannibal2.skyhanni.config.features.*;
import at.hannibal2.skyhanni.features.HideArmor;
import at.hannibal2.skyhanni.features.MarkedPlayerManager;
-import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFormatter;
import com.google.gson.annotations.Expose;
import net.minecraft.client.Minecraft;
@@ -63,11 +62,6 @@ public class Features extends Config {
return;
}
- if (runnableId.equals("firePillar")) {
- editOverlay(activeConfigCategory, 200, 16, slayer.firePillarPos);
- return;
- }
-
if (runnableId.equals("ashfangResetCooldown")) {
editOverlay(activeConfigCategory, 200, 16, ashfang.nextResetCooldownPos);
return;
@@ -93,16 +87,6 @@ public class Features extends Config {
return;
}
- if (runnableId.equals("testAllChat")) {
- PlayerChatFormatter.Companion.testAllChat();
- return;
- }
-
- if (runnableId.equals("testGuildChat")) {
- PlayerChatFormatter.Companion.testGuildChat();
- return;
- }
-
if (runnableId.equals("markOwnPlayer")) {
MarkedPlayerManager.Companion.toggleOwn();
return;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java b/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java
index 614568903..890d21313 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java
@@ -22,4 +22,9 @@ public class Bazaar {
@ConfigOption(name = "Best Sell Method Position", desc = "")
@ConfigEditorButton(runnableId = "bestSellMethod", buttonText = "Edit")
public Position bestSellMethodPos = new Position(10, 10, false, true);
+
+ @Expose
+ @ConfigOption(name = "Cancelled Buy Order Clipboard", desc = "Saves missing items from cancelled buy orders to clipboard for faster re-entry.")
+ @ConfigEditorBoolean
+ public boolean cancelledBuyOrderClipboard = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
index d00813c2b..029731f96 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
@@ -2,10 +2,16 @@ package at.hannibal2.skyhanni.config.features;
import at.hannibal2.skyhanni.config.core.config.annotations.*;
import com.google.gson.annotations.Expose;
+import org.lwjgl.input.Keyboard;
public class Chat {
@Expose
+ @ConfigOption(name = "Peek Chat", desc = "Hold this key to keep the chat open")
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_Z)
+ public int peekChat = Keyboard.KEY_Z;
+
+ @Expose
@ConfigOption(name = "Chat Filter Types", desc = "")
@ConfigEditorAccordion(id = 0)
public boolean filterTypes = false;
@@ -14,125 +20,70 @@ public class Chat {
@ConfigOption(name = "Hypixel Hub", desc = "Block messages outside SkyBlock in the Hypixel lobby: player joins, loot boxes, prototype lobby messages, radiating generosity and Hypixel tournaments.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean hypixelHub = false;
+ public boolean hypixelHub = true;
@Expose
@ConfigOption(name = "Empty", desc = "Hide all the empty messages from the chat.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean empty = false;
+ public boolean empty = true;
@Expose
@ConfigOption(name = "Warping", desc = "Block 'sending request to join ..' and 'warping ..' messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean warping = false;
+ public boolean warping = true;
@Expose
@ConfigOption(name = "Welcome", desc = "Hide the 'welcome to skyblock' message.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean welcome = false;
+ public boolean welcome = true;
- //TODO remove
@Expose
- @ConfigOption(name = "Others", desc = "Hide other annoying messages.")
+ @ConfigOption(name = "Guild Exp", desc = "Hide Guild Exp messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean others = false;
+ public boolean guildExp = true;
@Expose
- @ConfigOption(name = "Player Messages", desc = "")
- @ConfigEditorAccordion(id = 1)
- public boolean playerMessages = false;
+ @ConfigOption(name = "Friend Join Left", desc = "Hide friend join/left messages.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean friendJoinLeft = false;
@Expose
- @ConfigOption(name = "Message Format", desc = "")
- @ConfigAccordionId(id = 1)
- @ConfigEditorAccordion(id = 2)
- public boolean messageFormat = false;
+ @ConfigOption(name = "Winter Gifts", desc = "Hide useless winter gift messages.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean winterGift = true;
@Expose
- @ConfigOption(name = "All Channel Prefix", desc = "Show the prefix for the all channel chat.")
+ @ConfigOption(name = "Powder Mining", desc = "Hide messages while opening chests in crystal hollows.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
- public boolean allChannelPrefix = false;
+ @ConfigAccordionId(id = 0)
+ public boolean powderMining = true;
+ //TODO remove
@Expose
- @ConfigOption(name = "Player Rank Hider", desc = "Hide player ranks in the chat.")
+ @ConfigOption(name = "Others", desc = "Hide other annoying messages.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
- public boolean playerRankHider = false;
+ @ConfigAccordionId(id = 0)
+ public boolean others = false;
@Expose
- @ConfigOption(name = "Player Colon Hider", desc = "Hide the colon after the player name in the chat.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
- public boolean playerColonHider = false;
-
- @Expose
- @ConfigOption(
- name = "SkyBlock Level Design",
- desc = "Change the design of the Skyblock Level in the chat.\n" +
- "§cRequires 'SkyBlock Level in Chat' enabled in the SkyBlock Menu."
- )
- @ConfigEditorDropdown(
- values = {"§8[§6123§8] §bname§f: msg",
- "§6§l123 §bname§f: §fmsg",
- "§bname §8[§6123§8]§f: msg",
- "§cHide SkyBlock Level"}
- )
- @ConfigAccordionId(id = 2)
- public int skyblockLevelDesign = 0;
-
- @Expose
- @ConfigOption(
- name = "Elite Design",
- desc = "Change the design of the Elite position in the chat."
- )
- @ConfigEditorDropdown(
- values = {"§6[⌬499]",
- "§6§l⌬499",
- "§cHide Elite Position"}
- )
- @ConfigAccordionId(id = 2)
- public int eliteFormat = 0;
-
- @Expose
- @ConfigOption(
- name = "Channel Design",
- desc = "Change the design of the Channel Prefix in the chat."
- )
- @ConfigEditorDropdown(
- values = {"§2Guild >",
- "§2G>",
- "§8<§2G§8>",
- "§8[§2G§8]",
- "§8(§2G§8)"}
- )
- @ConfigAccordionId(id = 2)
- public int channelDesign = 0;
-
- @Expose
- @ConfigOption(name = "Test All Chat", desc = "Test the All Chat message format locally (no message gets sent to hypixel)")
- @ConfigEditorButton(runnableId = "testAllChat")
- @ConfigAccordionId(id = 2)
- public boolean testAllChat = false;
-
- @Expose
- @ConfigOption(name = "Test Guild Chat", desc = "Test the Guild Chat message format locally (no message gets sent to hypixel)")
- @ConfigEditorButton(runnableId = "testGuildChat")
- @ConfigAccordionId(id = 2)
- public boolean testGuildChat = false;
-
- @Expose
- @ConfigOption(name = "NEU Profile Viewer", desc = "Click on a player name to open the Profile Viewer from NotEnoughUpdates")
+ @ConfigOption(name = "Player Messages", desc = "")
+ @ConfigEditorAccordion(id = 1)
+ public boolean playerMessages = false;
+
+ @Expose
+ @ConfigOption(name = "Player Rank Hider", desc = "Hide player ranks in all chat messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
- public boolean neuProfileViewer = false;
+ public boolean playerRankHider = true;
@Expose
- @ConfigOption(name = "Chat Filter", desc = "Scan messages sent by players in all-chat for blacklisted words and greys out the message")
+ @ConfigOption(name = "Chat Filter", desc = "Scan messages sent by players for blacklisted words and grey out the message if any are found.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
public boolean chatFilter = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
index 30672ac2e..85b527947 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
@@ -123,4 +123,9 @@ public class DevData {
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
public boolean filterBiomeIdBounds = false;
+
+ @Expose
+ @ConfigOption(name = "Print Event Timings", desc = "Prints every 10 seconds the timings of all SkyHanni events in the chat.")
+ @ConfigEditorBoolean
+ public boolean printEventTimings = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java
index 40f58df81..074d4e0f7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java
@@ -69,7 +69,7 @@ public class Dungeon {
@Expose
@ConfigOption(name = "Highlight Deathmites", desc = "Highlight deathmites in dungeon in red color.")
@ConfigEditorBoolean
- public boolean highlightDeathmites = false;
+ public boolean highlightDeathmites = true;
@ConfigOption(name = "Object Hider", desc = "Hide various things in dungeon.")
@ConfigEditorAccordion(id = 3)
@@ -109,7 +109,7 @@ public class Dungeon {
@ConfigOption(name = "Hide Skeleton Skull", desc = "Hide skeleton skulls laying around in dungeon.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
- public boolean hideSkeletonSkull = false;
+ public boolean hideSkeletonSkull = true;
@Expose
@ConfigOption(name = "Hide Healer Orbs", desc = "Hides the damage, ability damage and defensive orbs that spawn when the healer kills mobs.")
@@ -149,9 +149,25 @@ public class Dungeon {
@ConfigAccordionId(id = 5)
public Position copilotPos = new Position(10, 10, false, true);
+ @ConfigOption(name = "Party Finder", desc = "")
+ @ConfigEditorAccordion(id = 6)
+ public boolean partyFinder = false;
+
+ @Expose
+ @ConfigOption(name = "Colored Class Level", desc = "Show the class levels in party finder in colors.")
+ @ConfigAccordionId(id = 6)
+ @ConfigEditorBoolean
+ public boolean partyFinderColoredClassLevel = true;
+
@Expose
@ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into a " +
"Skeletor in orange color (not useful combined with feature Hide Skeleton Skull)")
@ConfigEditorBoolean
- public boolean highlightSkeletonSkull = false;
+ public boolean highlightSkeletonSkull = true;
+
+ @Expose
+ @ConfigOption(name = "Croesus Unopened Chest Tracker", desc = "Adds a visual highlight to the Croesus inventory that " +
+ "shows what chests have not yet been opened.")
+ @ConfigEditorBoolean
+ public boolean croesusUnopenedChestTracker = true;
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
index 780db21e1..175dcb42d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
@@ -89,13 +89,14 @@ public class Inventory {
)
@ConfigEditorDraggableList(
exampleText = {
- "\u00a7bMaster Star Tier",
- "\u00a7bMaster Skull Tier",
- "\u00a7bDungeon Head Floor Number",
- "\u00a7bNew Year Cake",
- "\u00a7bPet Level",
- "\u00a7bMinion Tier",
- "\u00a7bCrimson Armor",
+ "§bMaster Star Tier",
+ "§bMaster Skull Tier",
+ "§bDungeon Head Floor Number",
+ "§bNew Year Cake",
+ "§bPet Level",
+ "§bMinion Tier",
+ "§bCrimson Armor",
+ "§bWishing Compass"
}
)
public List<Integer> itemNumberAsStackSize = new ArrayList<>(Collections.singletonList(3));
@@ -115,4 +116,10 @@ public class Inventory {
desc = "Show a compact star count in the item name for all items")
@ConfigEditorBoolean
public boolean itemStars = false;
+
+ @Expose
+ @ConfigOption(name = "Highlight Depleted Bonzo's Masks",
+ desc = "Highlights used Bonzo's Masks with a background")
+ @ConfigEditorBoolean
+ public boolean highlightDepletedBonzosMasks = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
index 7038014b2..1aeaf5f33 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.config.features;
-import at.hannibal2.skyhanni.config.core.config.Position;
import at.hannibal2.skyhanni.config.core.config.annotations.*;
import com.google.gson.annotations.Expose;
@@ -77,12 +76,6 @@ public class Slayer {
public boolean firePillarDisplay = false;
@Expose
- @ConfigOption(name = "Pillar Display Position", desc = "")
- @ConfigEditorButton(runnableId = "firePillar", buttonText = "Edit")
- @ConfigAccordionId(id = 3)
- public Position firePillarPos = new Position(10, 10, false, true);
-
- @Expose
@ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer and hide pillar build sound for the Blaze Slayer.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
index 39459fe83..95d9aff04 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
@@ -12,9 +12,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ChatManager {
- private val loggerAll = LorenzLogger("chat/filter_all")
- private val loggerFiltered = LorenzLogger("chat/filter_blocked")
- private val loggerAllowed = LorenzLogger("chat/filter_allowed")
+ private val loggerAll = LorenzLogger("chat/all")
+ private val loggerFiltered = LorenzLogger("chat/blocked")
+ private val loggerAllowed = LorenzLogger("chat/allowed")
+ private val loggerModified = LorenzLogger("chat/modified")
private val loggerFilteredTypes = mutableMapOf<String, LorenzLogger>()
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
@@ -34,10 +35,12 @@ class ChatManager {
fun onChatReceive(event: ClientChatReceivedEvent) {
if (event.type.toInt() == 2) return
- val messageComponent = event.message
- val message = LorenzUtils.stripVanillaMessage(messageComponent.formattedText)
+ val original = event.message
+ val message = LorenzUtils.stripVanillaMessage(original.formattedText)
+
+ if (message.startsWith("§f{\"server\":\"")) return
- val chatEvent = LorenzChatEvent(message, messageComponent)
+ val chatEvent = LorenzChatEvent(message, original)
chatEvent.postAndCatch()
val blockReason = chatEvent.blockedReason.uppercase()
@@ -50,9 +53,14 @@ class ChatManager {
return
}
- if (!message.startsWith("§f{\"server\":\"")) {
- loggerAllowed.log(message)
- loggerAll.log("[allowed] $message")
+ val modified = chatEvent.chatComponent
+ loggerAllowed.log("[allowed] $message")
+ loggerAll.log("[allowed] $message")
+ if (modified.formattedText != original.formattedText) {
+ event.message = chatEvent.chatComponent
+ loggerModified.log(" ")
+ loggerModified.log("[original] " + original.formattedText)
+ loggerModified.log("[modified] " + modified.formattedText)
}
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt
index 384b0546d..69ae9fa2d 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt
@@ -14,14 +14,26 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ItemTipHelper {
+// private val lastColorCacheTime = HashMap<String, Long>()
+// private val cache = HashMap<String, String>()
+
@SubscribeEvent
- fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) {
+ fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
val stack = event.stack ?: return
if (!LorenzUtils.inSkyblock || stack.stackSize != 1) return
- val itemTipEvent = RenderItemTipEvent(stack)
- itemTipEvent.postAndCatch()
- val stackTip = itemTipEvent.stackTip
+// val uuid = stacremovek.getLore().joinToString { ", " }
+ val stackTip: String
+// if (lastColorCacheTime.getOrDefault(uuid, 0L) + 1000 > System.currentTimeMillis()) {
+// stackTip = cache[uuid]!!
+// } else {
+ val itemTipEvent = RenderItemTipEvent(stack)
+ itemTipEvent.postAndCatch()
+ stackTip = itemTipEvent.stackTip
+// cache[uuid] = stackTip
+// lastColorCacheTime[uuid] = System.currentTimeMillis()
+// }
+
if (stackTip.isEmpty()) return
GlStateManager.disableLighting()
diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
index 4b1df77a4..9a993cb77 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
@@ -27,10 +27,10 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container:
abstract class DrawSlotEvent(gui: GuiContainer, container: Container, open val slot: Slot) :
GuiContainerEvent(gui, container) {
@Cancelable
- data class Pre(override val gui: GuiContainer, override val container: Container, override val slot: Slot) :
+ data class GuiContainerDrawSlotPre(override val gui: GuiContainer, override val container: Container, override val slot: Slot) :
DrawSlotEvent(gui, container, slot)
- data class Post(override val gui: GuiContainer, override val container: Container, override val slot: Slot) :
+ data class GuiContainerDrawSlotPost(override val gui: GuiContainer, override val container: Container, override val slot: Slot) :
DrawSlotEvent(gui, container, slot)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt
index ade6ce835..f879dbc39 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt
@@ -11,7 +11,7 @@ abstract class GuiRenderItemEvent : LorenzEvent() {
open val y: Int,
open val text: String?
) : GuiRenderItemEvent() {
- data class Post(
+ data class GuiRenderItemPost(
override val fontRenderer: FontRenderer,
override val stack: ItemStack?,
override val x: Int,
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt
index 2c7db6bd7..891ab340c 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt
@@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.events
import net.minecraft.util.IChatComponent
-class LorenzChatEvent(val message: String, val chatComponent: IChatComponent, var blockedReason: String = "") : LorenzEvent() \ No newline at end of file
+class LorenzChatEvent(val message: String, var chatComponent: IChatComponent, var blockedReason: String = "") : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
index 506894a9a..fc130de50 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
@@ -1,17 +1,42 @@
package at.hannibal2.skyhanni.events
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.Event
-abstract class LorenzEvent: Event() {
+abstract class LorenzEvent : Event() {
+
+ companion object {
+ val map = mutableMapOf<String, Long>()
+ var lastPrint = 0L
+ }
+
private val eventName by lazy {
this::class.simpleName
}
fun postAndCatch(): Boolean {
return runCatching {
- MinecraftForge.EVENT_BUS.post(this)
+ if (!SkyHanniMod.feature.dev.printEventTimings) {
+ return MinecraftForge.EVENT_BUS.post(this)
+ }
+ val start = System.currentTimeMillis()
+ val result = MinecraftForge.EVENT_BUS.post(this)
+ val end = System.currentTimeMillis() - start
+ eventName?.let { map.put(it, end + map.getOrDefault(it, 0)) }
+ if (System.currentTimeMillis() > lastPrint + 10_000) {
+ lastPrint = System.currentTimeMillis()
+ println(" ")
+ println("Event Timings!")
+ for (entry in GriffinJavaUtils.sortByValue(map)) {
+ println(entry.key + ": " + entry.value + " ms")
+ }
+ println(" ")
+ map.clear()
+ }
+ result
}.onFailure {
it.printStackTrace()
LorenzUtils.chat("§cSkyHanni caught and logged an ${it::class.simpleName ?: "error"} at ${eventName}.")
diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt
deleted file mode 100644
index 12b9300e4..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-import at.hannibal2.skyhanni.features.chat.playerchat.PlayerMessageChannel
-import net.minecraft.util.ChatComponentText
-
-class PlayerSendChatEvent(
- val channel: PlayerMessageChannel,
- val name: String,
- val message: String,
- val chatComponents: MutableList<ChatComponentText>,
- var cancelledReason: String = "",
-) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt
deleted file mode 100644
index 0146c0467..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-import net.minecraftforge.fml.common.eventhandler.Cancelable
-
-@Cancelable
-class RenderParticleEvent(val particleId: Int, val callerClass: String, val x: Double, val y: Double, val z: Double) :
- LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt
deleted file mode 100644
index 6387ab145..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package at.hannibal2.skyhanni.features
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.RenderParticleEvent
-import at.hannibal2.skyhanni.utils.EntityUtils.getEntitiesNearby
-import at.hannibal2.skyhanni.utils.LorenzVec
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.monster.EntityBlaze
-import net.minecraft.util.EnumParticleTypes
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class HideBlazeParticles {
-
- @SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- val particleId = event.particleId
- if (!SkyHanniMod.feature.misc.hideBlazeParticles) return
-
- val particleType = EnumParticleTypes.values().find { it.particleID == particleId }
- if (particleType != EnumParticleTypes.SMOKE_LARGE) return
-
- val location = LorenzVec(event.x, event.y, event.z)
- val clazz = EntityBlaze::class.java
- if (Minecraft.getMinecraft().theWorld.getEntitiesNearby(clazz, location, 3.0).isNotEmpty()) {
- event.isCanceled = true
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt
index b1c1ac4e8..17ebec137 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/MarkedPlayerManager.kt
@@ -1,7 +1,6 @@
package at.hannibal2.skyhanni.features
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.PlayerSendChatEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
@@ -9,7 +8,6 @@ import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
-import net.minecraft.util.EnumChatFormatting
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -17,7 +15,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
class MarkedPlayerManager {
companion object {
- private val playerNamesToMark = mutableListOf<String>()
+ val playerNamesToMark = mutableListOf<String>()
private val markedPlayers = mutableMapOf<String, EntityOtherPlayerMP>()
fun command(args: Array<String>) {
@@ -119,16 +117,4 @@ class MarkedPlayerManager {
}
}
}
-
- @SubscribeEvent
- fun onMarkedChatMessage(event: PlayerSendChatEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- for (chatComponent in event.chatComponents) {
- val text = chatComponent.unformattedText
- if (isMarkedPlayer(text) && SkyHanniMod.feature.markedPlayers.highlightInChat) {
- chatComponent.chatStyle.color = EnumChatFormatting.YELLOW
- }
- }
- }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
new file mode 100644
index 000000000..3943e7d44
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
@@ -0,0 +1,58 @@
+package at.hannibal2.skyhanni.features.bazaar
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.OSUtils
+import net.minecraftforge.event.entity.player.ItemTooltipEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class BazaarCancelledBuyOrderClipboard {
+
+ private val patternLastAmount = Pattern.compile("§a(.*)§7x")
+ private val patternCancelledMessage =
+ Pattern.compile("§6\\[Bazaar] §r§7§r§cCancelled! §r§7Refunded §r§6(.*) coins §r§7from cancelling Buy Order!")
+
+ private var latestAmount: String? = null
+
+ @SubscribeEvent
+ fun onTooltip(event: ItemTooltipEvent) {
+ if (!isEnabled()) return
+
+ val stack = event.itemStack ?: return
+ val name = stack.name ?: return
+ if (!name.contains("Cancel Order")) return
+
+ for (line in stack.getLore()) {
+ val matcher = patternLastAmount.matcher(line)
+ if (matcher.find()) {
+ latestAmount = matcher.group(1)
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+
+ val message = event.message
+
+ val matcher = patternCancelledMessage.matcher(message)
+ if (matcher.matches()) {
+ event.blockedReason = "bazaar cancelled buy order clipbaord"
+ val coins = matcher.group(1)
+
+ LorenzUtils.chat("§e[SkyHanni] Bazaar buy order cancelled. $latestAmount saved to clipboard. ($coins coins)")
+
+ latestAmount?.let { OSUtils.copyToClipboard(it.replace(",", "")) }
+ latestAmount = null
+ }
+ }
+
+ fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.bazaar.cancelledBuyOrderClipboard
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
index 505e1dee6..f1334cee1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -24,7 +24,9 @@ class ChatFilter {
empty(message) && SkyHanniMod.feature.chat.empty -> "empty"
warping(message) && SkyHanniMod.feature.chat.warping -> "warping"
welcome(message) && SkyHanniMod.feature.chat.welcome -> "welcome"
- guild(message) && SkyHanniMod.feature.chat.others -> "guild"
+ isGuildExp(message) && SkyHanniMod.feature.chat.guildExp -> "guild_exp"
+ friendJoin(message) && SkyHanniMod.feature.chat.friendJoinLeft -> "friend_join"
+
killCombo(message) && SkyHanniMod.feature.chat.others -> "kill_combo"
bazaarAndAHMiniMessages(message) && SkyHanniMod.feature.chat.others -> "bz_ah_minis"
watchdogAnnouncement(message) && SkyHanniMod.feature.chat.others -> "watchdog"
@@ -36,9 +38,11 @@ class ChatFilter {
money(message) && SkyHanniMod.feature.chat.others -> "money"
winterIsland(message) && SkyHanniMod.feature.chat.others -> "winter_island"
uselessWarning(message) && SkyHanniMod.feature.chat.others -> "useless_warning"
- friendJoin(message) && SkyHanniMod.feature.chat.others -> "friend_join"
annoyingSpam(message) && SkyHanniMod.feature.chat.others -> "annoying_spam"
+ isWinterGift(message) && SkyHanniMod.feature.chat.winterGift -> "winter_gift"
+ isPowderMining(message) && SkyHanniMod.feature.chat.powderMining -> "powder_mining"
+
else -> ""
}
@@ -142,7 +146,6 @@ class ChatFilter {
}
private fun party(message: String): Boolean {
- if (message == "§9§m-----------------------------") return true
if (message == "§9§m-----------------------------------------------------") return true
return false
@@ -248,7 +251,7 @@ class ChatFilter {
private fun killCombo(message: String): Boolean {
//§a§l+5 Kill Combo §r§8+§r§b3% §r§b? Magic Find
return when {
- message.matchRegex("§.§l\\+(.*) Kill Combo §r§8\\+(.*)") -> true
+ message.matchRegex("§.§l\\+(.*) Kill Combo (.*)") -> true
message == "§6§l+50 Kill Combo" -> true
message.matchRegex("§cYour Kill Combo has expired! You reached a (.*) Kill Combo!") -> true
else -> false
@@ -257,12 +260,14 @@ class ChatFilter {
private fun lobby(message: String): Boolean = when {
//player join
- message.matchRegex("(.*) §6joined the lobby!") -> true
- message.matchRegex(" §b>§c>§a>§r (.*) §6joined the lobby!§r §a<§c<§b<") -> true
+ message.matchRegex(".* §6joined the lobby!") -> true
+ message.matchRegex(" §b>§c>§a>§r §r.*§f §6slid into the lobby!§r §a<§c<§b<") -> true
+ message.matchRegex(".* §6slid into the lobby!") -> true
+ message.matchRegex(" §b>§c>§a>§r .* §6joined the lobby!§r §a<§c<§b<") -> true
//mystery box
- message.matchRegex("§b✦ §r(.*) §r§7found a §r§e(.*) §r§bMystery Box§r§7!") -> true
- message.matchRegex("§b✦ §r(.*) §r§7found (a|an) §r(.*) §r§7in a §r§aMystery Box§r§7!") -> true
+ message.matchRegex("§b✦ §r.* §r§7found a §r§e.* §r§bMystery Box§r§7!") -> true
+ message.matchRegex("§b✦ §r.* §r§7found (a|an) §r.* §r§7in a §r§aMystery Box§r§7!") -> true
//prototype
message.contains("§r§6§lWelcome to the Prototype Lobby§r") -> true
@@ -277,13 +282,10 @@ class ChatFilter {
else -> false
}
- private fun guild(message: String): Boolean = when {
- message.matchRegex("§2Guild > (.*) §r§e(joined|left).") -> true
- message.matchRegex("§aYou earned §r§2(.*) GEXP §r§afrom playing SkyBlock!") -> true
- message.matchRegex("§aYou earned §r§2(.*) GEXP §r§a\\+ §r§e(.*) Event EXP §r§afrom playing SkyBlock!") -> true
- message == "§b§m-----------------------------------------------------" -> true
- else -> false
- }
+ private fun isGuildExp(message: String) =
+ // §aYou earned §r§22 GEXP §r§afrom playing SkyBlock!
+ // §aYou earned §r§22 GEXP §r§a+ §r§c210 Event EXP §r§afrom playing SkyBlock!
+ message.matchRegex("§aYou earned §r§2.* GEXP (§r§a\\+ §r§.* Event EXP )?§r§afrom playing SkyBlock!")
private fun welcome(message: String): Boolean = message == "§eWelcome to §r§aHypixel SkyBlock§r§e!"
@@ -318,4 +320,57 @@ class ChatFilter {
else -> false
}
+
+ private fun isWinterGift(message: String): Boolean = when {
+ //winter gifts useless
+ message.matchRegex("§f§lCOMMON! §r§3.* XP §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("(§f§lCOMMON|§9§lRARE)! §r.* XP Boost .* Potion §r.*§r§e!") -> true
+ message.matchRegex("(§f§lCOMMON|§9§lRARE)! §r§6.* coins §r§egift with §r.*§r§e!") -> true
+
+ //enchanted book
+ message.matchRegex("§9§lRARE! §r§9Scavenger IV §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§9§lRARE! §r§9Looting IV §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§9§lRARE! §r§9Luck VI §r§egift with §r.*§r§e!") -> true
+
+ message.matchRegex("§e§lSWEET! §r§f(Grinch|Santa|Gingerbread Man) Minion Skin §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§9§lRARE! §r§f◆ Ice Rune §r§egift with §r.*§r§e!") -> true
+
+ //furniture
+ message.matchRegex("§e§lSWEET! §r§fTall Holiday Tree §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§e§lSWEET! §r§fNutcracker §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§e§lSWEET! §r§fPresent Stack §r§egift with §r.*§r§e!") -> true
+
+ message.matchRegex("§e§lSWEET! §r§9(Winter|Battle) Disc §r§egift with §r.*§r§e!") -> true
+
+ //winter gifts a bit useful
+ message.matchRegex("§e§lSWEET! §r§9Winter Sack §r§egift with §r.*§r§e!") -> true
+ message.matchRegex("§e§lSWEET! §r§5Snow Suit .* §r§egift with §r.*§r§e!") -> true
+
+ //winter gifts not your gifts
+ message.matchRegex("§cThis gift is for §r.*§r§c, sorry!") -> true
+
+ else -> false
+ }
+
+ private fun isPowderMining(message: String) = when {
+ message.matchRegex("§cYou need a stronger tool to mine (Amethyst|Ruby|Jade|Amber|Sapphire|Topaz) Gemstone Block§r§c.") -> true
+
+ message.matchRegex("§aYou received §r§f\\d* §r§f[❤❈☘⸕✎✧] §r§fRough (Ruby|Amethyst|Jade|Amber|Sapphire|Topaz) Gemstone§r§a\\.") -> true
+ message.matchRegex("§aYou received §r§f\\d §r§a[❤❈☘⸕✎✧] §r§aFlawed (Ruby|Amethyst|Jade|Amber|Sapphire|Topaz) Gemstone§r§a\\.") -> true
+
+
+ message == "§aYou uncovered a treasure chest!" -> true
+ message == "§aYou received §r§f1 §r§aWishing Compass§r§a." -> true
+ message == "§aYou received §r§f1 §r§9Ascension Rope§r§a." -> true
+
+ //Jungle
+ message.matchRegex("§aYou received §r§f\\d* §r§aSludge Juice§r§a\\.") -> true
+ message == "§aYou received §r§f1 §r§aOil Barrel§r§a." -> true
+
+ //Useful, maybe in another chat
+ message.matchRegex("§aYou received §r§b\\+\\d{1,3} §r§a(Mithril|Gemstone) Powder") -> true
+ message == "§6You have successfully picked the lock on this chest!" -> true
+
+ else -> false
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
index f0576fa62..2510aa0b0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt
@@ -1,19 +1,27 @@
package at.hannibal2.skyhanni.features.chat.playerchat
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.PlayerSendChatEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.MultiFilter
-import net.minecraft.util.ChatComponentText
-import net.minecraft.util.EnumChatFormatting
-import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class PlayerChatFilter {
- private val filters = mutableMapOf<String, MultiFilter>()
+ companion object {
+
+ private val filters = mutableMapOf<String, MultiFilter>()
+
+ fun shouldChatFilter(original: String): Boolean {
+ val message = original.lowercase()
+ for (filter in filters) {
+ filter.value.matchResult(message)?.let {
+ return true
+ }
+ }
+
+ return false
+ }
+ }
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
@@ -42,48 +50,4 @@ class PlayerChatFilter {
LorenzUtils.error("error in RepositoryReloadEvent")
}
}
-
- @SubscribeEvent(priority = EventPriority.HIGH)
- fun onPlayerChat(event: PlayerSendChatEvent) {
- if (!SkyHanniMod.feature.chat.chatFilter) return
- if (event.channel != PlayerMessageChannel.ALL) return
-
- val message = event.message.lowercase()
- for (filter in filters) {
- filter.value.matchResult(message)?.let {
- filter(event, it)
- return
- }
- }
- }
-
- private fun filter(event: PlayerSendChatEvent, filter: String) {
- val pattern = Pattern.compile("(.*)?$filter(.*)?", Pattern.CASE_INSENSITIVE)
- val matcher = pattern.matcher(event.message)
- matcher.matches()
- val beginning = matcher.group(1)
- val end = matcher.group(2)
-
- event.chatComponents.clear()
-
- val endSplit = end.split(" ")
-
- for (word in beginning.split(" ")) {
- if (word.isEmpty()) continue
- event.chatComponents.add(coloredChat(word, EnumChatFormatting.GRAY))
- }
-
- event.chatComponents.add(coloredChat(filter.trim(), EnumChatFormatting.WHITE))
-
- for (word in endSplit) {
- if (word.isEmpty()) continue
- event.chatComponents.add(coloredChat(word, EnumChatFormatting.GRAY))
- }
- }
-
- private fun coloredChat(string: String, color: EnumChatFormatting): ChatComponentText {
- val text = ChatComponentText(string)
- text.chatStyle.color = color
- return text
- }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt
deleted file mode 100644
index ea06519d6..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFormatter.kt
+++ /dev/null
@@ -1,312 +0,0 @@
-package at.hannibal2.skyhanni.features.chat.playerchat
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PlayerSendChatEvent
-import at.hannibal2.skyhanni.features.MarkedPlayerManager
-import at.hannibal2.skyhanni.utils.LorenzLogger
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import net.minecraft.client.Minecraft
-import net.minecraft.event.ClickEvent
-import net.minecraft.event.HoverEvent
-import net.minecraft.util.ChatComponentText
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
-
-class PlayerChatFormatter {
-
- private val loggerPlayerChat = LorenzLogger("chat/player")
-
- private val sbaIconList = listOf(
- "§5ቾ", // mage
- "§c⚒", // barbarian
- "§7♲", // ironman
- //TODO test if bingo is working
- "§aⒷ", // bingo rank 1
- "§9Ⓑ", // bingo rank 2
- "§5Ⓑ" // bingo rank 3
-
- //maybe coming soon
- //"§6Ⓑ" // bingo rank 4
- )
-
- private val patternUrl =
- Pattern.compile("^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$")
-
- //§6[⌬57] §r§8[§r§b235§r§8] §r§6[MVP§r§c++§r§6] hannibal2§r§f: Hello World!
- private val patternElitePrefix = Pattern.compile("§6\\[⌬(\\d+)] (.+)")
-
- //§8[§9109§8] §b[MVP§c+§b] 4Apex§f§r§f: omg selling
- private val patternSkyBlockLevel = Pattern.compile("§8\\[§(.)(\\d+)§8] (.+)")
-
- // SBA is adding another §d in front of the message
- //§dTo §r§b[MVP§r§3+§r§b] Skyfall55§r§7: §r§7hello :)
- private var patternPrivateMessage = Pattern.compile("(§d)+(To|From) §r(.+)§r§7: §r§7(.+)")
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.isOnHypixel) return
-
- if (shouldBlock(event.message)) {
- event.blockedReason = "player_chat"
- }
- }
-
- @SubscribeEvent(receiveCanceled = true)
- fun onChatWithUrl(event: PlayerSendChatEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- for (chatComponent in event.chatComponents) {
- val text = chatComponent.unformattedText
- if (patternUrl.matcher(text).matches()) {
- chatComponent.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.OPEN_URL, text)
- }
- }
- }
-
- private fun shouldBlock(originalMessage: String): Boolean {
- if (handlePrivateMessage(originalMessage)) return true
-
- //since hypixel sends own chat messages really weird " §r§8[§r§d205§r§8] §r§6[MVP§r§c++§r§6] hannibal2"
- var rawMessage = originalMessage.replace("§r", "").trim()
-
- val matcherElite = patternElitePrefix.matcher(rawMessage)
- val elitePrefix = if (matcherElite.matches()) {
- val elitePosition = matcherElite.group(1).toInt()
- rawMessage = matcherElite.group(2)
- when (SkyHanniMod.feature.chat.eliteFormat) {
- 0 -> "§6[⌬$elitePosition] "
- 1 -> "§6§l⌬$elitePosition "
- 2 -> ""
- else -> ""
- }
- } else {
- ""
- }
-
-
- val level: Int
- val levelColor: String
- val matcher = patternSkyBlockLevel.matcher(rawMessage)
- if (matcher.matches()) {
- levelColor = matcher.group(1)
- level = matcher.group(2).toInt()
- rawMessage = matcher.group(3)
- } else {
- level = -1
- levelColor = ""
- }
-
- val split = if (rawMessage.contains("§7§7: ")) {
- rawMessage.split("§7§7: ")
- } else if (rawMessage.contains("§f: ")) {
- rawMessage.split("§f: ")
- } else {
- return false
- }
-
- var rawName = split[0]
- val channel = grabChannel(rawName)
-
- rawName = rawName.substring(channel.originalPrefix.length)
-
- val sbaData = fetchSBAIcons(rawName)
- val sbaIcons = sbaData.first
- rawName = sbaData.second
-
- val name = grabName(rawName) ?: return false
-
- val message = split[1].removeColor()
- callEvent(channel, name, message, level, levelColor, elitePrefix, sbaIcons)
- return true
- }
-
- private fun fetchSBAIcons(rawName: String): Pair<String, String> {
- val iconsSplit = rawName.split(" ")
- var sbaIcons = ""
- var toRemove = 0
- for (text in iconsSplit) {
- sbaIconList.find { text.contains(it) }?.let {
- sbaIcons += " $it"
- toRemove++
- }
- }
- var name = iconsSplit.dropLast(toRemove).joinToString(" ")
-
- // Test if any unknown icons are left
- if (!name.split(" ").last().any { it in 'A'..'Z' || it in 'a'..'z' }) {
- println(" ")
- println("Unknown chat icon detected!")
- LorenzUtils.chat("§c[SkyHanni] Unknown chat icon detected!")
- println("name 1: '$rawName'")
- println("name 2: '$name'")
- name = rawName
- }
-
- return Pair(sbaIcons, name)
- }
-
- private fun handlePrivateMessage(originalMessage: String): Boolean {
- val matcher = patternPrivateMessage.matcher(originalMessage)
- if (!matcher.matches()) return false
- val direction = matcher.group(2)
- var rawName = matcher.group(3)
-
- val sbaData = fetchSBAIcons(rawName)
- val sbaIcons = sbaData.first
- rawName = sbaData.second
-
- val name = grabName(rawName) ?: return false
-
- val message = matcher.group(4)
- val colon = if (SkyHanniMod.feature.chat.playerColonHider) "" else ":"
- LorenzUtils.chat("§d$direction $name$sbaIcons§f$colon $message")
- loggerPlayerChat.log("[Msg_$direction] $name: $message")
- return true
- }
-
- private fun grabChannel(name: String): PlayerMessageChannel {
- return PlayerMessageChannel.values()
- .find { it != PlayerMessageChannel.ALL && name.startsWith(it.originalPrefix) }
- ?: PlayerMessageChannel.ALL
- }
-
- private fun grabName(rawName: String, clean: Boolean = false): String? {
- val nameSplit = rawName.removeColor().split(" ")
- val last = nameSplit.last()
- val cleanName = if (last.endsWith("]")) {
- nameSplit[nameSplit.size - 2]
- } else {
- last
- }
-
- val first = nameSplit[0]
- if (first != cleanName) {
- if (!first.contains("VIP") && !first.contains("MVP")) {
- //TODO support yt + admin
- return null
- }
- }
-
- if (clean) {
- return cleanName
- }
-
- val markedPlayer = MarkedPlayerManager.isMarkedPlayer(cleanName) && SkyHanniMod.feature.markedPlayers.highlightInChat
- return if (SkyHanniMod.feature.chat.playerRankHider) {
- if (markedPlayer) "§e$cleanName" else "§b$cleanName"
- } else {
- if (markedPlayer) {
- if (rawName.contains(" ")) {
- rawName[0] + " §e" + cleanName
- } else {
- "§e$cleanName"
- }
- } else {
- rawName
- }
- }
- }
-
- private fun callEvent(
- channel: PlayerMessageChannel,
- formattedName: String,
- message: String,
- level: Int,
- levelColor: String,
- elitePrefix: String,
- sbaIcons: String,
- ) {
- val cleanName = grabName(formattedName, true)!!
- loggerPlayerChat.log("[$channel] $cleanName: $message")
-
-
- val chatComponents = mutableListOf<ChatComponentText>()
- for (line in message.split(" ")) {
- chatComponents.add(ChatComponentText(line))
- }
-
- val event = PlayerSendChatEvent(channel, cleanName, message, chatComponents)
- event.postAndCatch()
-
- if (event.cancelledReason != "") {
- loggerPlayerChat.log("cancelled: " + event.cancelledReason)
- return
- }
-
- val channelPrefix = getChannelPrefix(channel)
- val colon = if (SkyHanniMod.feature.chat.playerColonHider) "" else ":"
- val levelFormat = getLevelFormat(formattedName + sbaIcons, level, levelColor)
-
- val nameText = ChatComponentText("$channelPrefix$elitePrefix$levelFormat§f$colon")
- if (SkyHanniMod.feature.chat.neuProfileViewer) {
- nameText.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pv $cleanName")
- nameText.chatStyle.chatHoverEvent = HoverEvent(
- HoverEvent.Action.SHOW_TEXT,
- ChatComponentText("§7Click to open the §cNEU Profile Viewer §7for $formattedName")
- )
- }
-
- addChat(nameText, chatComponents)
- }
-
- private fun addChat(prefixComponent: ChatComponentText, chatComponents: MutableList<ChatComponentText>) {
- val empty = ChatComponentText(" ")
-
- val result = ChatComponentText("")
- result.appendSibling(prefixComponent)
-
- for (chatComponent in chatComponents) {
- result.appendSibling(empty)
- result.appendSibling(chatComponent)
- }
-
- Minecraft.getMinecraft().thePlayer.addChatMessage(result)
- }
-
- private fun getLevelFormat(name: String, level: Int, levelColor: String): String {
- if (level == -1) return name
-
- return when (SkyHanniMod.feature.chat.skyblockLevelDesign) {
- 0 -> "§8[§${levelColor}${level}§8] $name"
- 1 -> "§${levelColor}§l${level} $name"
- 2 -> "$name §8[§${levelColor}${level}§8]"
- 3 -> name
- else -> "§8[§${levelColor}${level}§8] $name"
- }
- }
-
- private fun getChannelPrefix(channel: PlayerMessageChannel): String {
- if (channel == PlayerMessageChannel.ALL && !SkyHanniMod.feature.chat.allChannelPrefix) return ""
-
- val color = channel.prefixColor
- val small = channel.prefixSmall
- val large = channel.prefixLarge
- return when (SkyHanniMod.feature.chat.channelDesign) {
- 0 -> "$color$large §8> "
- 1 -> "$color$small> "
- 2 -> "§8<$color$small§8> "
- 3 -> "§8[$color$small§8] "
- 4 -> "§8($color$small§8) "
- else -> "$color$large §8> "
- }
- }
-
- companion object {
-
- fun testAllChat() {
- val name = Minecraft.getMinecraft().thePlayer.name
- val message =
- "§6[⌬499] §8[§b123§8] §6[MVP§c++§6] $name§f: This is a all chat test message and will not be sent to hypixel."
- LorenzChatEvent(message, ChatComponentText(message)).postAndCatch()
- }
-
- fun testGuildChat() {
- val name = Minecraft.getMinecraft().thePlayer.name
- val message =
- "§2Guild > §6[MVP§f++§6] $name §2[GuildRank]§f: This is a guild chat test message and will not be sent to hypixel."
- LorenzChatEvent(message, ChatComponentText(message)).postAndCatch()
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt
new file mode 100644
index 000000000..5072152a7
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt
@@ -0,0 +1,106 @@
+package at.hannibal2.skyhanni.features.chat.playerchat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.features.MarkedPlayerManager
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.IChatComponent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class PlayerChatModifier {
+
+ private val patterns = mutableListOf<Regex>()
+
+ init {
+ patterns.add("§(?:a|b|6)\\[(?:VIP|MVP)(?:(?:§.|\\+)*)](?: {1,2})(?:§[7ab6])?(\\w{2,16})".toRegex()) // ranked player everywhere
+ patterns.add("§(?:7|a|b|6)((?:\\w+){2,16})§r(?!§7x)".toRegex()) // nons in notification message
+ patterns.add("(?:§7 )?§7((?:\\w+){2,16})§7§r".toRegex()) // nons user chat
+ }
+
+ @SubscribeEvent
+ fun onChatReceive(event: LorenzChatEvent) {
+ val foundCommands = mutableListOf<IChatComponent>()
+ val message = event.chatComponent
+
+ addComponent(foundCommands, event.chatComponent)
+ for (sibling in message.siblings) {
+ addComponent(foundCommands, sibling)
+ }
+
+ val size = foundCommands.size
+ if (size > 1) {
+ return
+ }
+ val original = event.chatComponent.formattedText
+ val newText = cutMessage(original)
+ if (original == newText) return
+
+
+ val text = ChatComponentText(newText)
+ if (size == 1) {
+ val chatStyle = foundCommands[0].chatStyle
+ text.chatStyle.chatClickEvent = chatStyle.chatClickEvent
+ text.chatStyle.chatHoverEvent = chatStyle.chatHoverEvent
+ }
+ event.chatComponent = text
+ }
+
+ private fun addComponent(foundCommands: MutableList<IChatComponent>, message: IChatComponent) {
+ val clickEvent = message.chatStyle.chatClickEvent
+ if (clickEvent != null) {
+ if (foundCommands.size == 1) {
+ if (foundCommands[0].chatStyle.chatClickEvent.value == clickEvent.value) {
+ return
+ }
+ }
+ foundCommands.add(message)
+ }
+ }
+
+ private fun cutMessage(input: String): String {
+ var string = input
+
+ //all players same color in chat
+ string = string.replace("§r§7: ", "§r§f: ")
+
+ if (SkyHanniMod.feature.chat.chatFilter) {
+ if (string.contains("§r§f: ")) {
+ if (PlayerChatFilter.shouldChatFilter(string)) {
+ string = string.replace("§r§f: ", "§r§7: ")
+ }
+ }
+ }
+
+ if (SkyHanniMod.feature.chat.playerRankHider) {
+ for (pattern in patterns) {
+ string = string.replace(pattern, "§b$1")
+ }
+ string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16})'s", "§b$1's")
+ string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16}) (§.)", "§b$1 $2")
+ }
+
+ if (SkyHanniMod.feature.markedPlayers.highlightInChat) {
+ for (markedPlayer in MarkedPlayerManager.playerNamesToMark) {
+ string = string.replace(markedPlayer, "§e$markedPlayer§r")
+ }
+ }
+
+ return string
+ }
+
+// private fun shouldChatFilter(input: String): Boolean {
+// val text = input.lowercase()
+//
+// //Low baller
+// if (text.contains("lowballing")) return true
+// if (text.contains("lowballer")) return true
+//
+// //Trade
+// if (text.contains("buy")) return true
+// if (text.contains("sell")) return true
+// if (text.contains("on my ah")) return true
+//
+//
+// return false
+// }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt
deleted file mode 100644
index b75f2c970..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerMessageChannel.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package at.hannibal2.skyhanni.features.chat.playerchat
-
-enum class PlayerMessageChannel(
- val prefixColor: String,
- val prefixSmall: String,
- val prefixLarge: String,
- val originalPrefix: String,
-) {
-
- ALL("§f", "A", "All", ""),
- ALL_GUESTING("§a", "g", "Guest", "§a[✌] "),
- ALL_DUNGEON_DEAD("§7", "D", "Dead", "§7[GHOST] "),
- PARTY("§9", "P", "Party", "§9Party §8> "),
- GUILD("§2", "G", "Guild", "§2Guild > "),
- COOP("§b", "CC", "Co-op", "§bCo-op > "),
-
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt
new file mode 100644
index 000000000..ae5d5511d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt
@@ -0,0 +1,40 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.inventory.ContainerChest
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class CroesusUnopenedChestTracker {
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.dungeon.croesusUnopenedChestTracker) return
+
+ if (event.gui !is GuiChest) return
+ val guiChest = event.gui
+ val chest = guiChest.inventorySlots as ContainerChest
+ val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
+
+ if (chestName == "Croesus") {
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ val stack = slot.stack
+ val lore = stack.getLore()
+ if (lore.any { it.contains("Click to view") }) {
+ if (!lore.any { it.contains("Chests have been opened!") }) {
+ slot highlight LorenzColor.GREEN
+ }
+ }
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt
index 1ffd0fc70..e8636ed7c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt
@@ -24,7 +24,8 @@ class DungeonBossMessages {
when {
message.matchRegex("§([cd4])\\[BOSS] (.*)") -> {
when {
- message.contains(" The Watcher§r§f: ") -> return true
+ message.contains(" The Watcher§r§f: ") ->
+ message != "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass."
message.contains(" Bonzo§r§f: ") -> return true
message.contains(" Scarf§r§f:") -> return true
message.contains("Professor§r§f") -> return true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
index b4620ece4..ef19d53ec 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
@@ -18,7 +18,7 @@ class DungeonCopilot {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.inDungeons) return
+ if (!isEnabled()) return
val message = event.message
@@ -71,6 +71,7 @@ class DungeonCopilot {
}
if (message == "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass.") {
+ event.blockedReason = "dungeon copilot"
changeNextStep("Enter Boss Room")
}
}
@@ -127,8 +128,7 @@ class DungeonCopilot {
@SubscribeEvent
fun renderOverlay(event: RenderGameOverlayEvent.Post) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
- if (!LorenzUtils.inDungeons) return
- if (!SkyHanniMod.feature.dungeon.copilotEnabled) return
+ if (!isEnabled()) return
SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
new file mode 100644
index 000000000..796f93ef4
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
@@ -0,0 +1,55 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.inventory.ContainerChest
+import net.minecraftforge.event.entity.player.ItemTooltipEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class DungeonLevelColor {
+
+ private val pattern = Pattern.compile(" §.(.*)§f: §e(.*)§b \\(§e(.*)§b\\)")
+
+ @SubscribeEvent
+ fun onItemTooltip(event: ItemTooltipEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.dungeon.partyFinderColoredClassLevel) return
+
+ if (event.toolTip == null) return
+ val guiChest = Minecraft.getMinecraft().currentScreen
+ if (guiChest !is GuiChest) return
+ val chest = guiChest.inventorySlots as ContainerChest
+ val chestName = chest.lowerChestInventory.displayName.unformattedText.trim()
+ if (chestName != "Party Finder") return
+
+ val stack = event.itemStack
+ var index = 0
+ for (line in stack.getLore()) {
+ index++
+ val matcher = pattern.matcher(line)
+ if (!matcher.matches()) continue
+
+ val playerName = matcher.group(1)
+ val className = matcher.group(2)
+ val level = matcher.group(3).toInt()
+ val color = getColor(level)
+ event.toolTip[index] = " §b$playerName§f: §e$className $color$level"
+ }
+ }
+
+ private fun getColor(level: Int): String {
+ if (level >= 50) return "§c§l"
+ if (level >= 45) return "§c"
+ if (level >= 40) return "§d"
+ if (level >= 35) return "§b"
+ if (level >= 30) return "§5"
+ if (level >= 25) return "§9"
+ if (level >= 20) return "§a"
+ if (level >= 10) return "§f"
+ return "§7"
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
index f020590e7..b91d45dd8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt
@@ -54,5 +54,5 @@ class VoidlingExtremistColor {
}
private fun isEnabled(): Boolean =
- LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "The End" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor
+ LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "The End" && SkyHanniMod.feature.misc.voidlingExtremistColor
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt
new file mode 100644
index 000000000..371c0578d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt
@@ -0,0 +1,61 @@
+package at.hannibal2.skyhanni.features.inventory
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import at.hannibal2.skyhanni.utils.RenderUtils.interpolate
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
+import kotlin.time.Duration.Companion.seconds
+import kotlin.time.DurationUnit
+import kotlin.time.ExperimentalTime
+import kotlin.time.TimeMark
+import kotlin.time.TimeSource
+
+/**
+ * @author Linnea Gräf
+ */
+@OptIn(ExperimentalTime::class)
+class HighlightBonzoMasks {
+
+ val bonzoMaskTimers = mutableMapOf<String, TimeMark>()
+
+ // Technically this timer is overestimating since the cooldown is affected by mage level, however I do not care.
+ val bonzoMaskCooldown = 360.seconds
+ val bonzoMaskMessage = "Your (.*Bonzo's Mask) saved your life!".toRegex()
+
+ val greenHue = Color.RGBtoHSB(0, 255, 0, null)[0].toDouble()
+ val redHue = Color.RGBtoHSB(255, 0, 0, null)[0].toDouble()
+
+ @SubscribeEvent
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!SkyHanniMod.feature.inventory.highlightDepletedBonzosMasks) return
+ for (slot in event.gui.inventorySlots.inventorySlots) {
+ val item = slot.stack ?: continue
+ val internalName = item.getInternalName()
+ if (!internalName.endsWith("BONZO_MASK")) continue
+ val timer = bonzoMaskTimers[internalName] ?: continue
+ if (timer.elapsedNow() < bonzoMaskCooldown) {
+ val progress =
+ timer.elapsedNow().toDouble(DurationUnit.SECONDS) / bonzoMaskCooldown.toDouble(DurationUnit.SECONDS)
+ val hue = interpolate(greenHue, redHue, progress.toFloat())
+ slot.highlight(Color(Color.HSBtoRGB(hue.toFloat(), 1F, 1F)))
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onChatReceived(event: ClientChatReceivedEvent) {
+ val match = bonzoMaskMessage.matchEntire(event.message.unformattedText) ?: return
+ val bonzoId = if ("⚚" in match.groupValues[1]) "STARRED_BONZO_MASK" else "BONZO_MASK"
+ bonzoMaskTimers[bonzoId] = TimeSource.Monotonic.markNow()
+ }
+
+ @SubscribeEvent
+ fun onJoinWorld(ignored: WorldEvent.Load) {
+ bonzoMaskTimers.clear()
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
index bc1d310cc..4e25e3c83 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -10,9 +10,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
class ItemDisplayOverlayFeatures {
+ private val wishingCompassPattern = Pattern.compile("§7Remaining Uses: §e(.*)§8/§e3")
+
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
event.stackTip = getStackTip(event.stack)
@@ -83,6 +86,20 @@ class ItemDisplayOverlayFeatures {
}
}
+ if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(7)) {
+ if (name.contains("Wishing Compass")) {
+ for (line in item.getLore()) {
+ val matcher = wishingCompassPattern.matcher(line)
+ if (matcher.matches()) {
+ val uses = matcher.group(1)
+ if (uses != "3") {
+ return uses
+ }
+ }
+ }
+ }
+ }
+
return ""
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
index c299e7ef6..b99f0ff7b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.events.RenderParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.ItemUtils.name
@@ -35,21 +34,6 @@ class AshfangHideParticles {
event.isCanceled = true
}
- @SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- if (!isEnabled()) return
-
-
- when (event.callerClass) {
- "net.minecraft.block.BlockFire",
- "net.minecraft.entity.monster.EntityBlaze",
- "net.minecraft.entity.projectile.EntityFireball",
- -> {
- event.isCanceled = true
- }
- }
- }
-
@SubscribeEvent(priority = EventPriority.HIGH)
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!isEnabled()) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
index 1776c272e..e79157ed9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
@@ -71,7 +71,7 @@ class EndermanSlayerBeacon {
endermenWithBeacons.map { it.getLorenzVec().add(-0.5, 0.2, -0.5) }
.forEach { event.drawColor(it, LorenzColor.DARK_RED, alpha = 1f) }
- for (location in sittingBeacon) {
+ for (location in sittingBeacon.toMutableList()) {
event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f)
event.drawString(location.add(0.5, 0.5, 0.5), "§4Beacon", true)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
index 55a66ee14..d52287250 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt
@@ -50,7 +50,7 @@ class HighlightSlayerMiniboss {
})
list.addAll(entityList.filterIsInstance<EntityEnderman>().filter {
- it.hasMaxHealth(12_000_000) || it.hasMaxHealth(25_000_000)
+ it.hasMaxHealth(12_000_000) || it.hasMaxHealth(17_500_000) || it.hasMaxHealth(52_500_000)
})
list.addAll(entityList.filterIsInstance<EntityBlaze>().filter {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
index 8a9f58718..3f0e8ad76 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.events.RenderParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
@@ -47,21 +46,6 @@ class BlazeSlayerClearView {
}
@SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- if (isEnabled()) {
- when (event.callerClass) {
- "net.minecraft.block.BlockFire",
- "net.minecraft.entity.monster.EntityBlaze",
- "net.minecraft.entity.projectile.EntityFireball",
- -> {
- event.isCanceled = true
- return
- }
- }
- }
- }
-
- @SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (isEnabled()) {
val entity = event.entity
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 551fe6177..793764000 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -41,7 +41,8 @@ class BlazeSlayerDaggerHelper {
val message = event.message
if (message.matchRegex("§cStrike using the §r(.+) §r§cattunement on your dagger!") ||
- message == "§cYour hit was reduced by Hellion Shield!") {
+ message == "§cYour hit was reduced by Hellion Shield!"
+ ) {
event.blockedReason = "blaze_slayer_dagger"
}
}
@@ -82,10 +83,9 @@ class BlazeSlayerDaggerHelper {
if (lastNearestCheck + 100 > System.currentTimeMillis()) return lastNearest
lastNearestCheck = System.currentTimeMillis()
-
val playerLocation = LocationUtils.playerLocation()
return HellionShieldHelper.hellionShieldMobs
- .filter { it.key.getLorenzVec().distance(playerLocation) < 10 && it.key.health > 0 }
+ .filter { !it.key.isDead && it.key.getLorenzVec().distance(playerLocation) < 10 && it.key.health > 0 }
.toSortedMap { a, b ->
if (a.getLorenzVec().distance(playerLocation) > b.getLorenzVec().distance(playerLocation)) 1 else 0
}.firstNotNullOfOrNull { it.value }
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt
index 5f2221b8c..214e25eb7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
@@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
-import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -84,6 +84,7 @@ class BlazeSlayerPillar {
if (matcher.matches()) {
lastPillarSpawnTime = -1L
SoundUtils.createSound("note.pling", 0.7f).playSound()
+ SendTitleHelper.sendTitle("§cBlaze Pillar: §aExploded!", 500)
}
when (message) {
@@ -109,8 +110,10 @@ class BlazeSlayerPillar {
}
if (SkyHanniMod.feature.slayer.firePillarDisplay) {
- val format = DecimalFormat("0.0").format(remaining + 0.1)
- SkyHanniMod.feature.slayer.firePillarPos.renderString("§cBlaze Pillar: §a${format}s")
+ if (remaining > -0.5) {
+ val format = DecimalFormat("0.0").format(remaining + 0.1)
+ SendTitleHelper.sendTitle("§cBlaze Pillar: §a${format}s", 200)
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
index f8e0e225a..cfdff8a73 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
@@ -29,11 +29,11 @@ class GuiContainerHook(guiAny: Any) {
}
fun onDrawSlot(slot: Slot, ci: CallbackInfo) {
- if (GuiContainerEvent.DrawSlotEvent.Pre(gui, gui.inventorySlots, slot).postAndCatch()) ci.cancel()
+ if (GuiContainerEvent.DrawSlotEvent.GuiContainerDrawSlotPre(gui, gui.inventorySlots, slot).postAndCatch()) ci.cancel()
}
fun onDrawSlotPost(slot: Slot, ci: CallbackInfo) {
- GuiContainerEvent.DrawSlotEvent.Post(gui, gui.inventorySlots, slot).postAndCatch()
+ GuiContainerEvent.DrawSlotEvent.GuiContainerDrawSlotPost(gui, gui.inventorySlots, slot).postAndCatch()
}
fun onMouseClick(slot: Slot?, slotId: Int, clickedButton: Int, clickType: Int, ci: CallbackInfo) {
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
deleted file mode 100644
index 459d192f8..000000000
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package at.hannibal2.skyhanni.mixins.hooks
-
-import at.hannibal2.skyhanni.events.RenderParticleEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-
-class RenderGlobalHook {
- companion object {
- fun spawnParticle(
- particleId: Int,
- x: Double,
- y: Double,
- z: Double,
- ci: CallbackInfo,
- ) {
- val callerClass = LorenzUtils.getCallerClass(
- "at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook\$Companion",
- "at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook",
- "net.minecraft.client.renderer.RenderGlobal",
- "net.minecraft.world.World",
- "net.minecraft.client.network.NetHandlerPlayClient",
- "net.minecraft.network.play.server.S2APacketParticles",
- ) ?: "null"
-
- if (RenderParticleEvent(particleId, callerClass, x, y, z).postAndCatch()) {
- ci.cancel()
- return
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt
index 48d98fb5d..b94fad0d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt
@@ -19,7 +19,7 @@ fun renderItemOverlayPost(
text: String?,
ci: CallbackInfo
) {
- GuiRenderItemEvent.RenderOverlayEvent.Post(
+ GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost(
fr,
stack,
xPosition,
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderManagerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderManagerHook.kt
deleted file mode 100644
index 3e3283662..000000000
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderManagerHook.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package at.hannibal2.skyhanni.mixins.hooks
-
-import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
-import net.minecraft.client.renderer.culling.ICamera
-import net.minecraft.entity.Entity
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
-
-fun shouldRender(
- entityIn: Entity,
- camera: ICamera,
- camX: Double,
- camY: Double,
- camZ: Double,
- cir: CallbackInfoReturnable<Boolean>
-) {
- if (
- CheckRenderEntityEvent(
- entityIn,
- camera,
- camX,
- camY,
- camZ
- ).postAndCatch()
- ) cir.returnValue = false
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
index 8b6fce6b3..7a2a778e3 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
@@ -1,25 +1,25 @@
-package at.hannibal2.skyhanni.mixins.hooks.render
-
-import at.hannibal2.skyhanni.events.RenderBlockInWorldEvent
-import net.minecraft.block.state.IBlockState
-import net.minecraft.client.renderer.BlockRendererDispatcher
-import net.minecraft.client.resources.model.IBakedModel
-import net.minecraft.util.BlockPos
-import net.minecraft.world.IBlockAccess
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
-
-fun modifyGetModelFromBlockState(
- blockRendererDispatcher: Any,
- state: IBlockState?,
- worldIn: IBlockAccess,
- pos: BlockPos?,
- cir: CallbackInfoReturnable<IBakedModel>
-) {
- (blockRendererDispatcher as BlockRendererDispatcher).apply {
- val event = RenderBlockInWorldEvent(state, worldIn, pos)
- event.postAndCatch()
- if (event.state !== state) {
- cir.returnValue = blockModelShapes.getModelForState(event.state)
- }
- }
-} \ No newline at end of file
+//package at.hannibal2.skyhanni.mixins.hooks.render
+//
+//import at.hannibal2.skyhanni.events.RenderBlockInWorldEvent
+//import net.minecraft.block.state.IBlockState
+//import net.minecraft.client.renderer.BlockRendererDispatcher
+//import net.minecraft.client.resources.model.IBakedModel
+//import net.minecraft.util.BlockPos
+//import net.minecraft.world.IBlockAccess
+//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
+//
+//fun modifyGetModelFromBlockState(
+// blockRendererDispatcher: Any,
+// state: IBlockState?,
+// worldIn: IBlockAccess,
+// pos: BlockPos?,
+// cir: CallbackInfoReturnable<IBakedModel>
+//) {
+// (blockRendererDispatcher as BlockRendererDispatcher).apply {
+// val event = RenderBlockInWorldEvent(state, worldIn, pos)
+// event.postAndCatch()
+// if (event.state !== state) {
+// cir.returnValue = blockModelShapes.getModelForState(event.state)
+// }
+// }
+//} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java
new file mode 100644
index 000000000..d041a8b69
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.transformers;
+
+import at.hannibal2.skyhanni.SkyHanniMod;
+import net.minecraft.entity.monster.EntityBlaze;
+import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+@Mixin(EntityBlaze.class)
+public class MixinEntityBlaze {
+
+ @Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V"))
+ private void onLivingUpdate(World instance, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) {
+ if (!SkyHanniMod.feature.misc.hideBlazeParticles) {
+ instance.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_);
+ }
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java
deleted file mode 100644
index 8d5f58127..000000000
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package at.hannibal2.skyhanni.mixins.transformers;
-
-import at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook;
-import net.minecraft.client.renderer.RenderGlobal;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(RenderGlobal.class)
-public class MixinRenderGlobal {
-
- @Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true)
- private void spawnParticle(int particleId, boolean ignoreRange, double x, double y, double z, double xOffset, double yOffset, double zOffset, int[] p_180442_15_, CallbackInfo ci) {
- RenderGlobalHook.Companion.spawnParticle(particleId, x, y, z, ci);
- }
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java
index e36b87195..1085f6c7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.mixins.transformers;
-import at.hannibal2.skyhanni.mixins.hooks.RenderManagerHookKt;
+import at.hannibal2.skyhanni.events.CheckRenderEntityEvent;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
@@ -9,11 +9,28 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import java.util.HashMap;
+import java.util.UUID;
+
@Mixin(RenderManager.class)
public class MixinRenderManager {
+ private final HashMap<UUID, Long> lastColorCacheTime = new HashMap<>();
+ private final HashMap<UUID, Boolean> cache = new HashMap<>();
+
@Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true)
- private void shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> cir) {
- RenderManagerHookKt.shouldRender(entityIn, camera, camX, camY, camZ, cir);
+ private void shouldRender(Entity entity, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> cir) {
+ UUID uuid = entity.getUniqueID();
+ boolean shouldRender;
+ if (lastColorCacheTime.getOrDefault(uuid, 0L) + 1_000 > System.currentTimeMillis()) {
+ shouldRender = cache.get(uuid);
+ } else {
+ shouldRender = !new CheckRenderEntityEvent<>(entity, camera, camX, camY, camZ).postAndCatch();
+
+ cache.put(uuid, shouldRender);
+ lastColorCacheTime.put(uuid, System.currentTimeMillis());
+ }
+
+ cir.setReturnValue(shouldRender);
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java
new file mode 100644
index 000000000..f21b4c948
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.transformers.gui;
+
+import at.hannibal2.skyhanni.SkyHanniMod;
+import net.minecraft.client.gui.GuiNewChat;
+import org.lwjgl.input.Keyboard;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(GuiNewChat.class)
+public class MixinGuiNewChat {
+
+ @Inject(method = "getChatOpen", at = @At("HEAD"), cancellable = true)
+ public void onIsOpen(CallbackInfoReturnable<Boolean> cir) {
+ if (SkyHanniMod.feature.chat.peekChat != Keyboard.KEY_NONE && Keyboard.isKeyDown(SkyHanniMod.feature.chat.peekChat))
+ cir.setReturnValue(true);
+ }
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
index 32324ce7f..0714a6c2f 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
@@ -1,21 +1,13 @@
package at.hannibal2.skyhanni.mixins.transformers.renderer;
-import at.hannibal2.skyhanni.mixins.hooks.render.BlockRendererDispatcherHookKt;
-import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.resources.IResourceManagerReloadListener;
-import net.minecraft.client.resources.model.IBakedModel;
-import net.minecraft.util.BlockPos;
-import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(BlockRendererDispatcher.class)
public abstract class MixinBlockRendererDispatcher implements IResourceManagerReloadListener {
- @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true)
- private void modifyGetModelFromBlockState(IBlockState state, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable<IBakedModel> cir) {
- BlockRendererDispatcherHookKt.modifyGetModelFromBlockState(this, state, worldIn, pos, cir);
- }
+// @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true)
+// private void modifyGetModelFromBlockState(IBlockState state, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable<IBakedModel> cir) {
+//// BlockRendererDispatcherHookKt.modifyGetModelFromBlockState(this, state, worldIn, pos, cir);
+// }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
index 657636e87..5161d55da 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
@@ -13,23 +13,75 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import java.util.HashMap;
+import java.util.UUID;
+
+//TODO make guava caches working
@Mixin(RendererLivingEntity.class)
public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> extends Render<T> {
+
+ private final HashMap<UUID, Long> lastColorCacheTime = new HashMap<>();
+ private final HashMap<UUID, Integer> cachedColor = new HashMap<>();
+
+ private final HashMap<UUID, Long> lastHurtCacheTime = new HashMap<>();
+ private final HashMap<UUID, Boolean> cachedHurt = new HashMap<>();
+
+ // private final LoadingCache<EntityLivingBase, Integer> colorMultiplier;
protected MixinRendererLivingEntity(RenderManager renderManager) {
super(renderManager);
+
+// colorMultiplier = CacheBuilder.newBuilder()
+//// .maximumSize(1000)
+// .expireAfterWrite(2, TimeUnit.SECONDS)
+// .build(
+// new CacheLoader<EntityLivingBase, Integer>() {
+// @Override
+// public Integer load(@NotNull EntityLivingBase key) {
+// RenderMobColoredEvent event = new RenderMobColoredEvent(key, 0);
+// event.postAndCatch();
+// return event.getColor();
+// }
+// }
+// );
}
@Inject(method = "getColorMultiplier", at = @At("HEAD"), cancellable = true)
private void setColorMultiplier(T entity, float lightBrightness, float partialTickTime, CallbackInfoReturnable<Integer> cir) {
+ UUID uuid = entity.getUniqueID();
+ if (lastColorCacheTime.getOrDefault(uuid, 0L) + 1_000 > System.currentTimeMillis()) {
+ cir.setReturnValue(cachedColor.get(uuid));
+ return;
+ }
+
RenderMobColoredEvent event = new RenderMobColoredEvent(entity, 0);
event.postAndCatch();
- cir.setReturnValue(event.getColor());
+ int color = event.getColor();
+ cachedColor.put(uuid, color);
+ lastColorCacheTime.put(uuid, System.currentTimeMillis());
+ cir.setReturnValue(color);
+
+// try {
+// cir.setReturnValue(colorMultiplier.get(entity));
+// } catch (ExecutionException e) {
+// throw new RuntimeException(e);
+// }
}
@Redirect(method = "setBrightness", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityLivingBase;hurtTime:I", opcode = Opcodes.GETFIELD))
private int changeHurtTime(EntityLivingBase entity) {
- ResetEntityHurtEvent event = new ResetEntityHurtEvent(entity, false);
- event.postAndCatch();
- return event.getShouldReset() ? 0 : entity.hurtTime;
+ UUID uuid = entity.getUniqueID();
+
+ boolean shouldReset;
+ if (lastHurtCacheTime.getOrDefault(uuid, 0L) + 1_000 > System.currentTimeMillis()) {
+ shouldReset = cachedHurt.get(uuid);
+ } else {
+ ResetEntityHurtEvent event = new ResetEntityHurtEvent(entity, false);
+ event.postAndCatch();
+ shouldReset = event.getShouldReset();
+ cachedHurt.put(uuid, shouldReset);
+ lastHurtCacheTime.put(uuid, System.currentTimeMillis());
+ }
+
+ return shouldReset ? 0 : entity.hurtTime;
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index c82048e8c..8f0c4cc2c 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -83,19 +83,25 @@ class LorenzTest {
emptyList()
}
- val listenerClasses = SkyHanniMod.listenerClasses
- for (any in listenerClasses) {
- val simpleName = any.javaClass.simpleName
- MinecraftForge.EVENT_BUS.unregister(any)
+ val listeners = SkyHanniMod.listenerClasses
+ for (oldListener in listeners.toMutableList()) {
+ val javaClass = oldListener.javaClass
+ val simpleName = javaClass.simpleName
+ MinecraftForge.EVENT_BUS.unregister(oldListener)
println("Unregistered listener $simpleName")
+
if (simpleName !in blockedFeatures) {
- MinecraftForge.EVENT_BUS.register(any)
+ listeners.remove(oldListener)
+ val newListener = javaClass.newInstance()
+ listeners.add(newListener)
+
+ MinecraftForge.EVENT_BUS.register(newListener)
println("Registered listener $simpleName")
} else {
println("Skipped registering listener $simpleName")
}
}
- LorenzUtils.chat("§e[SkyHanni] reloaded ${listenerClasses.size} listener classes.")
+ LorenzUtils.chat("§e[SkyHanni] reloaded ${listeners.size} listener classes.")
}
}
diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json
index 0058e4053..337fe91de 100644
--- a/src/main/resources/mixins.skyhanni.json
+++ b/src/main/resources/mixins.skyhanni.json
@@ -4,9 +4,9 @@
"compatibilityLevel": "JAVA_8",
"mixins": [
"AccessorGuiPlayerTabOverlay",
+ "MixinEntityBlaze",
"MixinNetHandlerPlayClient",
"MixinNetworkManager",
- "MixinRenderGlobal",
"MixinRenderItem",
"MixinRenderManager",
"gui.AccessorGuiContainer",
@@ -15,5 +15,8 @@
"renderer.MixinBlockRendererDispatcher",
"renderer.MixinRendererLivingEntity",
"tileentity.TileEntitySignMixin"
+ ],
+ "client": [
+ "gui.MixinGuiNewChat"
]
}