aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordragon99z <dragon99@online.de>2023-07-21 19:51:29 +0200
committerGitHub <noreply@github.com>2023-07-21 19:51:29 +0200
commitfa1b4237c3bda4c26d58f21f4f59c96fcb1d7066 (patch)
treee36cfe796ee09908afa5fef00fe5dfb97d927dab
parentce144f7d52e1e30d145619646003fb3c86828418 (diff)
downloadskyhanni-fa1b4237c3bda4c26d58f21f4f59c96fcb1d7066.tar.gz
skyhanni-fa1b4237c3bda4c26d58f21f4f59c96fcb1d7066.tar.bz2
skyhanni-fa1b4237c3bda4c26d58f21f4f59c96fcb1d7066.zip
Merge pull request #327
* +added Eman slayer beacon highlight and beacon beam * +added Eman slayer beacon warning toggle * Merge remote-tracking branch 'origin/beta' into beta * +added Patcher sendcoords like command * formatting (Strg + Alt + L in IntelliJ)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinatesHighlight.kt80
4 files changed, 116 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 25658fb26..f84e875f0 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier
import at.hannibal2.skyhanni.features.commands.PartyTransferCommand
+import at.hannibal2.skyhanni.features.commands.SendCoordinatedCommand
import at.hannibal2.skyhanni.features.commands.WikiCommand
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.features.dungeon.*
@@ -204,6 +205,7 @@ class SkyHanniMod {
loadModule(RealTime())
loadModule(RngMeterInventory())
loadModule(WikiCommand())
+ loadModule(SendCoordinatedCommand())
loadModule(PartyTransferCommand())
loadModule(SummoningMobManager())
loadModule(AreaMiniBossFeatures())
@@ -279,6 +281,7 @@ class SkyHanniMod {
loadModule(GardenComposterInventoryFeatures())
loadModule(MinionCollectLogic())
loadModule(PasteIntoSigns())
+ loadModule(PatcherSendCoordinatesHighlight())
loadModule(EstimatedItemValue)
loadModule(EstimatedWardrobePrice())
loadModule(ComposterInventoryNumbers())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
index 43af8f090..0292eb6cc 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
@@ -655,6 +655,11 @@ public class MiscConfig {
public boolean restorePieceOfWizardPortalLore = true;
@Expose
+ @ConfigOption(name = "Patcher Coords Highlight", desc = "Highlight the the coords sended form patcher.")
+ @ConfigEditorBoolean
+ public boolean patcherSendCoordHighlight = false;
+
+ @Expose
@ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.")
@ConfigEditorBoolean
public boolean configButtonOnPause = true;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt
new file mode 100644
index 000000000..c9055976a
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt
@@ -0,0 +1,28 @@
+package at.hannibal2.skyhanni.features.commands
+
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.network.play.client.C01PacketChatMessage
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class SendCoordinatedCommand {
+
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+ if (packet is C01PacketChatMessage) {
+ val message = packet.message.lowercase()
+ if (message == "/sendcoords") {
+ event.isCanceled = true
+ val location = LocationUtils.playerLocation()
+ val x = location.x.toInt()
+ val y = location.y.toInt()
+ val z = location.z.toInt()
+ LorenzUtils.sendMessageToServer("x: $x, y: $y, z: $z")
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinatesHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinatesHighlight.kt
new file mode 100644
index 000000000..b9ac03626
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinatesHighlight.kt
@@ -0,0 +1,80 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzLogger
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
+import at.hannibal2.skyhanni.utils.RenderUtils.drawString
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class PatcherSendCoordinatesHighlight {
+
+ private val patcherBeacon = mutableListOf<LorenzVec>()
+ private val patcherName = mutableListOf<String>()
+ private val logger = LorenzLogger("misc/patchercoords")
+ private val pattern = "(?<playerName>.*): x: (?<x>.*), y: (?<y>.*), z: (?<z>.*)".toPattern()
+
+ @SubscribeEvent
+ fun onPatcherCoordinates(event: LorenzChatEvent) {
+ if (!SkyHanniMod.feature.misc.patcherSendCoordHighlight) return
+
+ val message = event.message.removeColor()
+ pattern.matchMatcher(message) {
+ val playerName = group("playerName").split(" ").last()
+ val x = group("x").toInt()
+ val y = group("y").toInt()
+ val z = group("z").toInt()
+
+ patcherBeacon.add(LorenzVec(x, y, z))
+ patcherName.add(playerName)
+ logger.log("got patcher coords and username")
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onWorldRender(event: RenderWorldLastEvent) {
+ if (!SkyHanniMod.feature.misc.patcherSendCoordHighlight) return
+
+ for (i in 0 until patcherBeacon.size) {
+ val location = patcherBeacon[i]
+ event.drawColor(location, LorenzColor.DARK_GREEN, alpha = 1f)
+ event.drawWaypointFilled(location, LorenzColor.GREEN.toColor(), true, true)
+ event.drawString(location.add(0.5, 0.5, 0.5), patcherName[i], true, LorenzColor.DARK_BLUE.toColor())
+ logger.log("added patcher beacon!")
+ }
+ }
+
+ @SubscribeEvent
+ fun onEnterWaypoint(event: TickEvent.PlayerTickEvent) {
+ if (!SkyHanniMod.feature.misc.patcherSendCoordHighlight) return
+
+ val player = event.player
+ if (player.motionX > 0 || player.motionZ > 0) {
+ val location = player.getLorenzVec()
+ for (i in 0 until patcherBeacon.size) {
+ if (location.distanceIgnoreY(patcherBeacon[i]) < 5) {
+ patcherBeacon.removeAt(i)
+ patcherName.removeAt(i)
+ logger.log("removed patcher beacon!")
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: WorldEvent.Load) {
+ patcherBeacon.clear()
+ patcherName.clear()
+ logger.log("Reset everything (world change)")
+ }
+} \ No newline at end of file