diff options
-rw-r--r-- | src/main/java/dulkirmod/mixins/MixinGuiContainer.java | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 29 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/events/ChatEvent.kt | 13 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/AlarmClock.kt | 14 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/Croesus.kt | 32 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/DungeonLeap.kt | 32 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt | 21 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/Utils.kt | 9 | ||||
-rw-r--r-- | src/main/resources/mixins.dulkirmod.json | 1 |
10 files changed, 162 insertions, 17 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinGuiContainer.java b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java new file mode 100644 index 0000000..6796703 --- /dev/null +++ b/src/main/java/dulkirmod/mixins/MixinGuiContainer.java @@ -0,0 +1,24 @@ +package dulkirmod.mixins; + +import dulkirmod.features.Croesus; +import dulkirmod.features.DungeonLeap; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +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(GuiContainer.class) +public abstract class MixinGuiContainer extends GuiScreen { + @Inject(at=@At("HEAD"), method="drawSlot", cancellable = true) + public void drawSlot(Slot slotIn, CallbackInfo ci) { + if (Croesus.Companion.inCroesus() && Croesus.Companion.isChestOpened(slotIn)) { + ci.cancel(); + } + if (DungeonLeap.Companion.inLeapMenu() && DungeonLeap.Companion.isHighlightedLeapPlayer(slotIn)) { + // TODO + } + } +} diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 9eb1464..0273af4 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -58,10 +58,10 @@ class DulkirMod { MinecraftForge.EVENT_BUS.register(this) MinecraftForge.EVENT_BUS.register(ChatEvent()) MinecraftForge.EVENT_BUS.register(NametagCleaner) - MinecraftForge.EVENT_BUS.register(DulkirMod.titleUtils) + MinecraftForge.EVENT_BUS.register(titleUtils) MinecraftForge.EVENT_BUS.register(ArachneTimer()) MinecraftForge.EVENT_BUS.register(MatchoAlert()) - + MinecraftForge.EVENT_BUS.register(Croesus()) keyBinds.forEach(ClientRegistry::registerKeyBinding) } diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index ebda0c5..df69eca 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -55,6 +55,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so @Property( type = PropertyType.SWITCH, + name = "Throttle Notifier Spam", + description = "LET EM KNOW!", + category = "Dungeons" + ) + var throttleNotifierSpam = true + + @Property( + type = PropertyType.SWITCH, name = "Hide Extra Nametags", description = "Prevents some nametags not covered by skytils \"Hide non-starred nametags\" from rendering.", category = "General" @@ -229,12 +237,30 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "JoinDungeon Command Confirmation", description = "Chat notification when you push the button. Useful if you suck at navigating a numpad.", - category = "Dungeon" + category = "Dungeons" ) var dungeonCommandConfirm = true @Property( type = PropertyType.SWITCH, + name = "Hide Chests that are already opened at Croesus", + description = "Just doesn't render the item if it has the chest opened string", + category = "Dungeons" + ) + var hideOpenedChests = false + + @Property( + type = PropertyType.TEXT, + name = "Highlighted player name", + description = "Not case-sensitive", + category = "Dungeons", + placeholder = "Dilkur", + protectedText = false + ) + var highlightLeapName: String = "Dilkur" + + @Property( + type = PropertyType.SWITCH, name = "Remove Selfie Camera", description = "Get rid of pesky reverse third person!", category = "General" @@ -431,6 +457,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so fun init() { initialize() addDependency("customMessage", "throttleNotifier") + addDependency("throttleNotifierSpam", "throttleNotifier") addDependency("bestiaryNotifVol", "bestiaryAlertSounds") addDependency("demoVolume", "bestiaryAlertSounds") diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt index e034996..290372a 100644 --- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt +++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt @@ -2,6 +2,7 @@ package dulkirmod.events import dulkirmod.DulkirMod import dulkirmod.config.Config +import dulkirmod.utils.Utils import dulkirmod.utils.Utils.stripColorCodes import net.minecraft.util.ChatComponentText import net.minecraft.util.EnumChatFormatting @@ -12,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChatEvent { private val guildFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+) > .+".toRegex() private val alternateFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+): .+".toRegex() + private var lastThrottle : Long = 0; @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) fun onChat(event: ClientChatReceivedEvent) { if (event.type == 2.toByte()) { @@ -20,9 +22,16 @@ class ChatEvent { // THROTTLE NOTIFIER val unformatted = stripColorCodes(event.message.unformattedText) - if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier) { + if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier + && Utils.isInDungeons()) { event.isCanceled = true; - DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + if (!Config.throttleNotifierSpam && System.currentTimeMillis() - lastThrottle > 5000) { + DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + } + else { + DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + } + lastThrottle = System.currentTimeMillis() } // BRIDGE BOT STUFF - CLICKABLE LINKS! diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt index 8dd0a32..075f106 100644 --- a/src/main/kotlin/dulkirmod/features/AlarmClock.kt +++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt @@ -3,9 +3,8 @@ package dulkirmod.features import dulkirmod.DulkirMod import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.Config +import dulkirmod.utils.ScoreBoardUtils import dulkirmod.utils.Utils -import net.minecraft.scoreboard.Score -import net.minecraft.scoreboard.ScorePlayerTeam var lastUpdate : Long = 0 @@ -14,16 +13,7 @@ fun alarmClock() { if (!Utils.isInSkyblock()) return // CHECK TIME val currTime : Long = System.currentTimeMillis() - val scoreboard = mc.thePlayer.worldScoreboard - val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1) - val scores: List<Score> = ArrayList(scoreboard.getSortedScores(sidebarObjective)) - val lines: MutableList<String> = ArrayList() - for (i in scores.indices.reversed()) { - val score = scores[i] - val scoreplayerteam1 = scoreboard.getPlayersTeam(score.playerName) - val line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.playerName) - lines.add(line) - } + val lines = ScoreBoardUtils.getLines() for (l in lines) { // ZOMBIE VILLAGER if (Config.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) { diff --git a/src/main/kotlin/dulkirmod/features/Croesus.kt b/src/main/kotlin/dulkirmod/features/Croesus.kt new file mode 100644 index 0000000..0ddfe9e --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/Croesus.kt @@ -0,0 +1,32 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.Config +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraft.inventory.Slot + +class Croesus { + companion object { + var currentlyOpenChestName = "" + + fun inCroesus(): Boolean { + if (mc.currentScreen == null || !(mc.currentScreen is GuiChest)) return false + val chest = mc.currentScreen as GuiChest + val container = chest.inventorySlots as ContainerChest + currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText + if (currentlyOpenChestName == "Croesus") return true + return false + } + + fun isChestOpened(slotIn: Slot): Boolean { + if (!Config.hideOpenedChests) return false + if (slotIn.stack?.getTooltip(mc.thePlayer, false) == null) return false + + var tooltip = slotIn.stack.getTooltip(mc.thePlayer, false) + if (tooltip.contains("§5§o§aChests have been opened!")) return true + + return false + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt new file mode 100644 index 0000000..54a304c --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt @@ -0,0 +1,32 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod +import dulkirmod.config.Config +import dulkirmod.utils.Utils +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraft.inventory.Slot + +class DungeonLeap { + companion object { + fun inLeapMenu(): Boolean { + if (DulkirMod.mc.currentScreen == null || !(DulkirMod.mc.currentScreen is GuiChest)) return false + val chest = DulkirMod.mc.currentScreen as GuiChest + val container = chest.inventorySlots as ContainerChest + Croesus.currentlyOpenChestName = container.lowerChestInventory.displayName.unformattedText + if (Croesus.currentlyOpenChestName == "Spirit Leap") return true + return false + } + + fun isHighlightedLeapPlayer(slotIn: Slot): Boolean { + if (slotIn.stack?.getTooltip(DulkirMod.mc.thePlayer, false) == null) return false + + val tooltip = slotIn.stack.getTooltip(DulkirMod.mc.thePlayer, false) + for (s in tooltip) { + var t = Utils.stripColorCodes(s) + if (t == Config.highlightLeapName) return true + } + return false + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt b/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt new file mode 100644 index 0000000..7b6c96d --- /dev/null +++ b/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt @@ -0,0 +1,21 @@ +package dulkirmod.utils + +import dulkirmod.DulkirMod +import net.minecraft.scoreboard.Score +import net.minecraft.scoreboard.ScorePlayerTeam + +object ScoreBoardUtils { + fun getLines() : MutableList<String> { + val scoreboard = DulkirMod.mc.thePlayer.worldScoreboard + val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1) + val scores: List<Score> = ArrayList(scoreboard.getSortedScores(sidebarObjective)) + val lines: MutableList<String> = ArrayList() + for (i in scores.indices.reversed()) { + val score = scores[i] + val scoreplayerteam1 = scoreboard.getPlayersTeam(score.playerName) + val line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.playerName) + lines.add(line) + } + return lines + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt index 3aff645..1a85d0a 100644 --- a/src/main/kotlin/dulkirmod/utils/Utils.kt +++ b/src/main/kotlin/dulkirmod/utils/Utils.kt @@ -67,6 +67,15 @@ object Utils { return false } + fun isInDungeons() : Boolean { + val lines = ScoreBoardUtils.getLines() + for (l in lines) { + if (l.contains("Catac\uD83C\uDF6D§combs")) + return true + } + return false + } + fun getColorString(int : Int) : String { return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString() } diff --git a/src/main/resources/mixins.dulkirmod.json b/src/main/resources/mixins.dulkirmod.json index 4921d12..6c35959 100644 --- a/src/main/resources/mixins.dulkirmod.json +++ b/src/main/resources/mixins.dulkirmod.json @@ -5,6 +5,7 @@ "refmap": "mixins.dulkirmod.refmap.json", "client": [ "ItemRendererMixin", + "MixinGuiContainer", "MixinRendererManager" ], "mixins": [ |