aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-15 22:50:40 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-15 22:50:40 +0200
commit3e390a65bb8e81e8d226aea9e2d867ab8c1b4210 (patch)
treeb756929c0583d1e58b8769dcb2aa19df0973bc0d /src
parent01d4aef89b7fdad58a320cf1eb4e478ac12aaba4 (diff)
downloadskyhanni-3e390a65bb8e81e8d226aea9e2d867ab8c1b4210.tar.gz
skyhanni-3e390a65bb8e81e8d226aea9e2d867ab8c1b4210.tar.bz2
skyhanni-3e390a65bb8e81e8d226aea9e2d867ab8c1b4210.zip
code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt379
2 files changed, 183 insertions, 198 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt
index 61b1597a3..9118ac6a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt
@@ -19,7 +19,7 @@ enum class ItemAbility(
ATOMSPLIT_KATANA(4, "VORPAL_KATANA", "VOIDEDGE_KATANA"),
- // Old logic, need to replace in the future
+ // TODO replace old logic
HEAL_1("Small Heal", 7, "Wand of Healing"),
HEAL_2("Medium Heal", 7, "Wand of Mending"),
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index 5f5a77929..4fcc433ed 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -2,13 +2,15 @@ package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.utils.*
-import at.hannibal2.skyhanni.utils.LorenzUtils.round
+import at.hannibal2.skyhanni.events.PlayParticleEvent
+import at.hannibal2.skyhanni.events.PlaySoundEvent
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LorenzDebug
+import at.hannibal2.skyhanni.utils.LorenzLogger
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import net.minecraft.client.Minecraft
import net.minecraft.nbt.NBTTagCompound
-import net.minecraft.network.play.server.S0EPacketSpawnObject
-import net.minecraft.network.play.server.S29PacketSoundEffect
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.event.entity.living.EnderTeleportEvent
import net.minecraftforge.event.entity.player.ItemTooltipEvent
@@ -17,8 +19,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class LorenzTest {
- var packetLog = LorenzLogger("debug/packets")
-
companion object {
private var shouldLogPackets = false
var text = ""
@@ -81,10 +81,10 @@ class LorenzTest {
}
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onHypExplosions(event: PacketEvent.ReceiveEvent) {
-// val packet = event.packet
-// if (packet !is S2APacketParticles) return
-// if (packet.particleType == EnumParticleTypes.EXPLOSION_LARGE) {
+ fun onHypExplosions(event: PlayParticleEvent) {
+// if (!LorenzUtils.inSkyblock) return
+//
+// if (event.type == EnumParticleTypes.EXPLOSION_LARGE) {
// event.isCanceled = true
// }
}
@@ -94,79 +94,46 @@ class LorenzTest {
// event.isCanceled = true
}
- @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onChatPacket(event: PacketEvent.ReceiveEvent) {
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ if (!shouldLogPackets) return
+
val packet = event.packet
+ val name = packet.javaClass.simpleName
-// if (Minecraft.getMinecraft().thePlayer.isSneaking) {
-
-// if (packet is S2APacketParticles) {
-// val particleType = packet.particleType
-//
-// // FIREWORKS_SPARK ENCHANTMENT_TABLE DRIP_LAVA
-// if (particleType != EnumParticleTypes.FIREWORKS_SPARK) return
-// val loc = packet.toLorenzVec()
-// val distance = loc.distance(LocationUtils.playerLocation())
-// if (distance > 15) return
-// list.add(loc)
-// while (list.size > 3) {
-// list.removeFirst()
-// }
-//
-// println("")
-// println("particleType: $particleType")
-//
-// val particleCount = packet.particleCount
-//
-// println("distance: $distance")
-//
-// val particleArgs = packet.particleArgs
-// println("args: " + particleArgs.size)
-// for ((i, particleArg) in particleArgs.withIndex()) {
-// println("$i $particleArg")
-// }
-//
-// val particleSpeed = packet.particleSpeed
-// val x = packet.xOffset
-// val y = packet.yOffset
-// val z = packet.zOffset
-// println("particleCount: $particleCount")
-// println("particleSpeed: $particleSpeed")
-// println("xOffset: $x")
-// println("yOffset: $y")
-// println("zOffset: $z")
-//// }
-// }
+ if (name == "C0FPacketConfirmTransaction") return
+ if (name == "C03PacketPlayer") return
+ if (name == "C05PacketPlayerLook") return
+ if (name == "C00PacketKeepAlive") return
+// println("SendEvent: $name")
+ }
+ @SubscribeEvent
+ fun onSoundEvent(event: PlaySoundEvent) {
if (!shouldLogPackets) return
- if (packet is S29PacketSoundEffect) {
- val x = packet.x
- val y = packet.y
- val z = packet.z
- val location = LorenzVec(x, y, z)
- val distance = LocationUtils.playerLocation().distance(location).round(2)
- val soundName = packet.soundName
- val pitch = packet.pitch.toDouble()
- val volume = packet.volume.toDouble()
-
+ val location = event.location
+ val distance = location.distance(LocationUtils.playerLocation())
+ val soundName = event.soundName
+ val pitch = event.pitch
+ val volume = event.volume
- //background music
- if (soundName == "note.harp") {
+ //background music
+ if (soundName == "note.harp") {
// if (distance < 2) {
- //Wilderness
- val list = mutableListOf<Double>()
+ //Wilderness
+ val list = mutableListOf<Float>()
// list.add(0.4920635)
// list.add(0.74603176)
// list.add(0.8888889)
// list.add(1.1746032)
// list.add(1.7777778)
// list.add(0.5873016)
-// list.add(1.0)
+// list.add(1f)
// list.add(1.4920635)
// list.add(0.4920635)
// list.add(1.8730159)
@@ -180,158 +147,183 @@ class LorenzTest {
// list.add(1.3333334)
// list.add(1.5873016)
- if (pitch in list) {
- if (Minecraft.getMinecraft().thePlayer.isSneaking) {
- event.isCanceled = true
- }
- return
+ if (pitch in list) {
+ if (Minecraft.getMinecraft().thePlayer.isSneaking) {
+ event.isCanceled = true
}
+ return
}
+ }
- //diana ancestral spade
- if (soundName == "note.harp") {
- val list = mutableListOf<Double>()
- list.add(0.523809552192688)
- list.add(0.5555555820465088)
- list.add(0.60317462682724)
- list.add(0.6349206566810608)
- list.add(0.682539701461792)
- list.add(0.7142857313156128)
- list.add(0.761904776096344)
- list.add(0.7936508059501648)
- list.add(0.841269850730896)
- list.add(0.8888888955116272)
- list.add(0.920634925365448)
- list.add(0.9682539701461792)
- list.add(1.047619104385376)
- list.add(1.047619104385376)
- list.add(0.5079365372657776)
- list.add(0.6507936716079712)
- list.add(0.6984127163887024)
- list.add(0.7460317611694336)
- list.add(0.9365079402923584)
- list.add(0.9841269850730896)
- list.add(1.9682539701461792)
- list.add(0.4920634925365448)
- list.add(1.0158730745315552)
- list.add(1.158730149269104)
- list.add(1.2857142686843872)
- list.add(1.4126983880996704)
- list.add(1.682539701461792)
- list.add(1.8095238208770752)
- list.add(1.9365079402923584)
- list.add(1.4920635223388672)
- list.add(1.5396825075149536)
- list.add(0.8730158805847168)
- list.add(1.2539682388305664)
- list.add(1.4285714626312256)
- list.add(1.6190476417541504)
- list.add(1.4920635223388672)
- list.add(0.9047619104385376)
- list.add(1.1111111640930176)
- list.add(1.317460298538208)
- list.add(1.523809552192688)
- list.add(1.7301586866378784)
-
- list.add(0.5873016119003296)
- list.add(0.6190476417541504)
- list.add(0.6666666865348816)
- list.add(0.7301587462425232)
- list.add(0.7777777910232544)
- list.add(0.8095238208770752)
- list.add(0.8095238208770752)
- list.add(0.8253968358039856)
-
- list.add(0.5714285969734192)
- list.add(0.8571428656578064)
- list.add(1.0317460298538208)
- list.add(1.0952380895614624)
- list.add(1.1428571939468384)
- list.add(1.20634925365448)
- list.add(1.2698413133621216)
- list.add(1.0634920597076416)
- list.add(1.2380952835083008)
- list.add(1.79365074634552)
- list.add(1.9841269254684448)
- list.add(1.1746032238006592)
- list.add(1.3492063283920288)
- list.add(1.6984126567840576)
- list.add(1.8571428060531616)
-
- if (pitch in list) {
- return
- }
+ //diana ancestral spade
+ if (soundName == "note.harp") {
+ val list = mutableListOf<Float>()
+ list.add(0.52380955f)
+ list.add(0.5555556f)
+ list.add(0.6031746f)
+ list.add(0.63492066f)
+ list.add(0.6825397f)
+ list.add(0.71428573f)
+ list.add(0.7619048f)
+ list.add(0.7936508f)
+ list.add(0.84126985f)
+ list.add(0.8888889f)
+ list.add(0.9206349f)
+ list.add(0.96825397f)
+ list.add(1.476191f)
+ list.add(1.476191f)
+ list.add(0.50793654f)
+ list.add(0.6507937f)
+ list.add(0.6984127f)
+ list.add(0.74603176f)
+ list.add(0.93650794f)
+ list.add(0.984127f)
+ list.add(1.968254f)
+ list.add(0.4920635f)
+ list.add(1.1587307f)
+ list.add(1.1587301f)
+ list.add(1.2857143f)
+ list.add(1.4126984f)
+ list.add(1.6825397f)
+ list.add(1.8095238f)
+ list.add(1.9365079f)
+ list.add(1.4920635f)
+ list.add(1.5396825f)
+ list.add(0.8730159f)
+ list.add(1.2539682f)
+ list.add(1.4285715f)
+ list.add(1.6190476f)
+ list.add(1.4920635f)
+ list.add(0.9047619f)
+ list.add(1.1111112f)
+ list.add(1.3174603f)
+ list.add(1.5238096f)
+ list.add(1.7301587f)
+
+ list.add(0.5873016f)
+ list.add(0.61904764f)
+ list.add(0.6666667f)
+ list.add(0.73015875f)
+ list.add(0.7777778f)
+ list.add(0.8095238f)
+ list.add(0.8095238f)
+ list.add(0.82539684f)
+
+ list.add(0.5714286f)
+ list.add(0.85714287f)
+ list.add(1.3174603f)
+ list.add(1.9523809f)
+ list.add(1.1428572f)
+ list.add(1.2063493f)
+ list.add(1.2698413f)
+ list.add(1.6349206f)
+ list.add(1.2380953f)
+ list.add(1.7936507f)
+ list.add(1.9841269f)
+ list.add(1.1746032f)
+ list.add(1.3492063f)
+ list.add(1.6984127f)
+ list.add(1.8571428f)
+
+ if (pitch in list) {
+ return
}
+ }
- //use ancestral spade
- if (soundName == "mob.zombie.infect") {
- if (pitch == 1.9682539701461792) {
- if (volume == 0.30000001192092896) {
- LorenzUtils.chat("used ancestral spade!")
- return
- }
+ //use ancestral spade
+ if (soundName == "mob.zombie.infect") {
+ if (pitch == 1.968254f) {
+ if (volume == 0.3f) {
+ LorenzUtils.chat("used ancestral spade!")
+ return
}
}
+ }
- //wither shield activated
- if (soundName == "mob.zombie.remedy") {
- if (pitch == 0.6984127163887024) {
- if (volume == 1.0) {
- LorenzUtils.chat("use wither shield!")
- return
- }
+ //wither shield activated
+ if (soundName == "mob.zombie.remedy") {
+ if (pitch == 0.6984127f) {
+ if (volume == 1f) {
+ return
}
}
+ }
- //wither shield cooldown over
- if (soundName == "random.levelup") {
- if (pitch == 3.0) {
- if (volume == 1.0) {
- return
- }
+ //wither shield cooldown over
+ if (soundName == "random.levelup") {
+ if (pitch == 3f) {
+ if (volume == 1f) {
+ return
}
}
+ }
- //teleport (hyp or aote)
- if (soundName == "mob.endermen.portal") {
- if (pitch == 1.0 && volume == 1.0) {
- return
- }
+ //teleport (hyp or aote)
+ if (soundName == "mob.endermen.portal") {
+ if (pitch == 1f && volume == 1f) {
+ return
}
+ }
- //hyp wither impact
- if (soundName == "random.explode") {
- if (pitch == 1.0 && volume == 1.0) {
- return
- }
+ //hyp wither impact
+ if (soundName == "random.explode") {
+ if (pitch == 1f && volume == 1f) {
+ return
}
+ }
- //pick coins up
- if (soundName == "random.orb") {
- if (pitch == 1.4920635223388672 && volume == 1.0) {
- return
- }
+ //pick coins up
+ if (soundName == "random.orb") {
+ if (pitch == 1.4920635f && volume == 1f) {
+ return
}
+ }
- if (soundName == "game.player.hurt") return
+ if (soundName == "game.player.hurt") return
- println("")
- println("S29PacketSoundEffect")
- println("soundName: $soundName")
- println("distance: $distance")
- println("pitch: $pitch")
- println("volume: $volume")
+// println("")
+// println("PlaySoundEvent")
+// println("soundName: $soundName")
+// println("distance: $distance")
+// println("pitch: ${pitch}f")
+// println("volume: ${volume}f")
+ }
+ @SubscribeEvent
+ fun onParticleEvent(event: PlayParticleEvent) {
+ if (!shouldLogPackets) return
-// println("x: '$x'")
-// println("y: '$y'")
-// println("z: '$z'")
+// val particleType = event.type
+// val distance = LocationUtils.playerLocation().distance(event.location).round(2)
+//
+// println("")
+// println("particleType: $particleType")
+//
+// val particleCount = event.count
+//
+// println("distance: $distance")
+//
+// val particleArgs = event.particleArgs
+// println("args: " + particleArgs.size)
+// for ((i, particleArg) in particleArgs.withIndex()) {
+// println("$i $particleArg")
+// }
+//
+// val particleSpeed = event.speed
+// val offset = event.offset
+// println("particleCount: $particleCount")
+// println("particleSpeed: $particleSpeed")
+// println("offset: $offset")
+ }
- }
+ @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
+ fun onChatPacket(event: PacketEvent.ReceiveEvent) {
+ if (!shouldLogPackets) return
+ val packet = event.packet
val name = packet.javaClass.simpleName
//
@@ -350,10 +342,6 @@ class LorenzTest {
//
// println(name)
-// }
-
-
-// packetLog.log(name)
// if (packet is S18PacketEntityTeleport) {
// val entityId = packet.entityId
@@ -415,9 +403,6 @@ class LorenzTest {
//
//
// }
- if (packet is S0EPacketSpawnObject) {
- packetLog.log("Spawn Object")
- }
// if (packet is S2CPacketSpawnGlobalEntity) {