aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/lorenz/mod/misc
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-14 12:06:07 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-14 12:06:07 +0200
commita5c540d977a3510812cac7fac340fe17e7d10983 (patch)
treedbbe5b208e6871378a10868d1206d1d78beeb950 /src/main/java/at/lorenz/mod/misc
parentd6c99ed30a2b1cb228b2fdc3d3178cf1f369dc53 (diff)
downloadskyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.gz
skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.bz2
skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.zip
renamed mod to SkyHanni
Diffstat (limited to 'src/main/java/at/lorenz/mod/misc')
-rw-r--r--src/main/java/at/lorenz/mod/misc/ButtonOnPause.kt51
-rw-r--r--src/main/java/at/lorenz/mod/misc/CurrentPetDisplay.kt53
-rw-r--r--src/main/java/at/lorenz/mod/misc/ExpBottleOnGroundHider.kt19
-rw-r--r--src/main/java/at/lorenz/mod/misc/HypixelData.kt63
-rw-r--r--src/main/java/at/lorenz/mod/misc/ScoreboardData.kt45
5 files changed, 0 insertions, 231 deletions
diff --git a/src/main/java/at/lorenz/mod/misc/ButtonOnPause.kt b/src/main/java/at/lorenz/mod/misc/ButtonOnPause.kt
deleted file mode 100644
index 7b4785ee0..000000000
--- a/src/main/java/at/lorenz/mod/misc/ButtonOnPause.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package at.lorenz.mod.misc
-
-import at.lorenz.mod.LorenzMod
-import at.lorenz.mod.utils.LorenzUtils
-import at.lorenz.mod.config.config.ConfigEditor
-import at.lorenz.mod.config.core.GuiScreenElementWrapper
-import net.minecraft.client.gui.GuiButton
-import net.minecraft.client.gui.GuiIngameMenu
-import net.minecraftforge.client.event.GuiScreenEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ButtonOnPause {
- private val buttonId = System.nanoTime().toInt()
-
- @SubscribeEvent
- fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) {
- if (!LorenzUtils.isOnHypixel) return
-
- if (LorenzMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) {
- LorenzMod.screenToOpen = GuiScreenElementWrapper(
- ConfigEditor(
- LorenzMod.feature
- )
- )
- }
- }
-
- @SubscribeEvent
- fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) {
- if (!LorenzUtils.isOnHypixel) return
-
- if (LorenzMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) {
- val x = event.gui.width - 105
- val x2 = x + 100
- var y = event.gui.height - 22
- var y2 = y + 20
- val sorted = event.buttonList.sortedWith { a, b -> b.yPosition + b.height - a.yPosition + a.height }
- for (button in sorted) {
- val otherX = button.xPosition
- val otherX2 = button.xPosition + button.width
- val otherY = button.yPosition
- val otherY2 = button.yPosition + button.height
- if (otherX2 > x && otherX < x2 && otherY2 > y && otherY < y2) {
- y = otherY - 20 - 2
- y2 = y + 20
- }
- }
- event.buttonList.add(GuiButton(buttonId, x, 0.coerceAtLeast(y), 100, 20, "Lorenz Mod"))
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/misc/CurrentPetDisplay.kt b/src/main/java/at/lorenz/mod/misc/CurrentPetDisplay.kt
deleted file mode 100644
index dcbbc1259..000000000
--- a/src/main/java/at/lorenz/mod/misc/CurrentPetDisplay.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package at.lorenz.mod.misc
-
-import at.lorenz.mod.LorenzMod
-import at.lorenz.mod.events.LorenzChatEvent
-import at.lorenz.mod.utils.GuiRender.renderString
-import at.lorenz.mod.utils.LorenzUtils
-import at.lorenz.mod.utils.LorenzUtils.between
-import at.lorenz.mod.utils.LorenzUtils.matchRegex
-import net.minecraftforge.client.event.RenderGameOverlayEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class CurrentPetDisplay {
-
- companion object {
- var currentPet: String = ""
- }
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- var blocked = false
-
- val message = event.message
- if (message.matchRegex("§aYou summoned your §r(.*)§r§a!")) {
- currentPet = message.between("your §r", "§r§a")
- blocked = true
- }
- if (message.matchRegex("§cAutopet §eequipped your §7(.*)§e! §a§lVIEW RULE")) {
- currentPet = message.between("] ", "§e!")
- blocked = true
- }
- if (message.matchRegex("§aYou despawned your §r(.*)§r§a!")) {
- currentPet = ""
- blocked = true
- }
-
- if (blocked && LorenzMod.feature.misc.petDisplay) {
- event.blockedReason = "pets"
- }
- }
-
-
- @SubscribeEvent
- fun renderOverlay(event: RenderGameOverlayEvent.Post) {
- if (!LorenzUtils.inSkyblock) return
-
- if (!LorenzMod.feature.misc.petDisplay) return
- if (currentPet == "") return
-
- LorenzMod.feature.misc.petDisplayPos.renderString(currentPet)
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/misc/ExpBottleOnGroundHider.kt b/src/main/java/at/lorenz/mod/misc/ExpBottleOnGroundHider.kt
deleted file mode 100644
index 6b263cdd9..000000000
--- a/src/main/java/at/lorenz/mod/misc/ExpBottleOnGroundHider.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package at.lorenz.mod.misc
-
-import at.lorenz.mod.LorenzMod
-import at.lorenz.mod.events.CheckRenderEntityEvent
-import at.lorenz.mod.utils.LorenzUtils
-import net.minecraft.entity.item.EntityXPOrb
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ExpBottleOnGroundHider {
- @SubscribeEvent
- fun onCheckRender(event: CheckRenderEntityEvent<*>) {
- if (!LorenzUtils.inSkyblock) return
- if (!LorenzMod.feature.misc.hideExpBottles) return
-
- if (event.entity is EntityXPOrb) {
- event.isCanceled = true
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/misc/HypixelData.kt b/src/main/java/at/lorenz/mod/misc/HypixelData.kt
deleted file mode 100644
index e7c5a02f6..000000000
--- a/src/main/java/at/lorenz/mod/misc/HypixelData.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package at.lorenz.mod.misc
-
-import at.lorenz.mod.events.PacketEvent
-import net.minecraft.client.Minecraft
-import net.minecraft.network.play.server.S38PacketPlayerListItem
-import net.minecraft.network.play.server.S3DPacketDisplayScoreboard
-import net.minecraftforge.event.world.WorldEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.network.FMLNetworkEvent
-
-class HypixelData {
-
- companion object {
- var hypixel = false
- var skyblock = false
- var dungeon = false
-}
-
- @SubscribeEvent
- fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
- hypixel = Minecraft.getMinecraft().runCatching {
- !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel")
- ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false)
- }.onFailure { it.printStackTrace() }.getOrDefault(false)
- }
-
- @SubscribeEvent
- fun onScoreboardChange(event: PacketEvent.ReceiveEvent) {
- if (!hypixel || skyblock || event.packet !is S3DPacketDisplayScoreboard) return
- if (event.packet.func_149371_c() != 1) return
- skyblock = event.packet.func_149370_d() == "SBScoreboard"
- }
-
- val areaRegex = Regex("§r§b§l(?<area>[\\w]+): §r§7(?<loc>[\\w ]+)§r")
-
- @SubscribeEvent
- fun onTabUpdate(event: PacketEvent.ReceiveEvent) {
- if (dungeon || !hypixel || event.packet !is S38PacketPlayerListItem ||
- (event.packet.action != S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME &&
- event.packet.action != S38PacketPlayerListItem.Action.ADD_PLAYER)
- ) return
- event.packet.entries.forEach { playerData ->
- val name = playerData?.displayName?.formattedText ?: playerData?.profile?.name ?: return@forEach
- areaRegex.matchEntire(name)?.let { result ->
- dungeon = skyblock && result.groups["area"]?.value == "Dungeon"
- return@forEach
- }
- }
- }
-
- @SubscribeEvent
- fun onWorldChange(event: WorldEvent.Load) {
- skyblock = false
- dungeon = false
- }
-
- @SubscribeEvent
- fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) {
- hypixel = false
- skyblock = false
- dungeon = false
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/lorenz/mod/misc/ScoreboardData.kt b/src/main/java/at/lorenz/mod/misc/ScoreboardData.kt
deleted file mode 100644
index e1735104d..000000000
--- a/src/main/java/at/lorenz/mod/misc/ScoreboardData.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package at.lorenz.mod.misc
-
-import at.lorenz.mod.utils.LorenzUtils.removeColorCodes
-import net.minecraft.client.Minecraft
-import net.minecraft.scoreboard.Score
-import net.minecraft.scoreboard.ScorePlayerTeam
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-
-class ScoreboardData {
-
- companion object {
- var sidebarLines: List<String> = emptyList()
- }
-
- @SubscribeEvent(priority = EventPriority.HIGHEST)
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (event.phase != TickEvent.Phase.START) return
-
- sidebarLines = fetchScoreboardLines().map { cleanSB(it) }
- }
-
- private fun cleanSB(scoreboard: String): String {
- return scoreboard.removeColorCodes().toCharArray().filter { it.code in 21..126 }.joinToString(separator = "")
- }
-
- fun fetchScoreboardLines(): List<String> {
- val scoreboard = Minecraft.getMinecraft().theWorld?.scoreboard ?: return emptyList()
- val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return emptyList()
- var scores = scoreboard.getSortedScores(objective)
- val list = scores.filter { input: Score? ->
- input != null && input.playerName != null && !input.playerName
- .startsWith("#")
- }
- scores = if (list.size > 15) {
- list.drop(15)
- } else {
- list
- }
- return scores.map {
- ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName)
- }
- }
-} \ No newline at end of file