aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt101
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt34
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt10
6 files changed, 148 insertions, 46 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 7d778f99d..1511f8db6 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -77,10 +77,7 @@ import at.hannibal2.skyhanni.features.rift.area.mirrorverse.TubulatorParkour
import at.hannibal2.skyhanni.features.rift.area.westvillage.KloonHacking
import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftOdonata
import at.hannibal2.skyhanni.features.rift.area.wyldwoods.ShyCruxWarnings
-import at.hannibal2.skyhanni.features.rift.everywhere.CruxTalismanDisplay
-import at.hannibal2.skyhanni.features.rift.everywhere.EnigmaSoulWaypoints
-import at.hannibal2.skyhanni.features.rift.everywhere.HighlightRiftGuide
-import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI
+import at.hannibal2.skyhanni.features.rift.everywhere.*
import at.hannibal2.skyhanni.features.slayer.*
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper
@@ -348,6 +345,7 @@ class SkyHanniMod {
loadModule(BlobbercystsHighlight())
loadModule(LivingCaveDefenseBlocks())
loadModule(LivingCaveLivingMetalHelper())
+ loadModule(RiftMotesOrb())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
index 11b415cfa..a2edb4681 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
@@ -567,4 +567,23 @@ public class RiftConfig {
@ConfigEditorSlider(minStep = 1, minValue = 0, maxValue = 5)
public int burgerStacks = 0;
}
+
+ @Expose
+ @ConfigOption(name = "Motes Orbs", desc = "")
+ @Accordion
+ public MotesOrbsConfig motesOrbsConfig = new MotesOrbsConfig();
+
+ public static class MotesOrbsConfig {
+
+ @Expose
+ @ConfigOption(name = "Highlight Motes Orbs", desc = "Highlight flying Motes Orbs.")
+ @ConfigEditorBoolean
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Hide Particles", desc = "Hide normal motes orbs particles.")
+ @ConfigEditorBoolean
+ public boolean hideParticles = false;
+
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
index 120e77e4d..a450280f9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
@@ -29,25 +29,11 @@ class LivingCaveDefenseBlocks {
private val config get() = RiftAPI.config.area.livingCaveConfig.defenseBlockConfig
private var movingBlocks = mapOf<DefenseBlock, Long>()
private var staticBlocks = emptyList<DefenseBlock>()
-// private var helpLocation = emptyList<LorenzVec>()
class DefenseBlock(val entity: EntityOtherPlayerMP, val location: LorenzVec, var hidden: Boolean = false)
@SubscribeEvent
fun onReceiveParticle(event: ReceiveParticleEvent) {
- val location = event.location.add(-0.5, 0.0, -0.5)
-
-// if (event.type == EnumParticleTypes.CRIT_MAGIC) {
-// helpLocation = helpLocation.editCopy { add(location) }
-// }
-
- // TODO remove
- Minecraft.getMinecraft().thePlayer?.let {
- if (it.isSneaking) {
- staticBlocks = emptyList()
-// helpLocation = emptyList()
- }
- }
if (!isEnabled()) return
movingBlocks = movingBlocks.editCopy {
@@ -55,6 +41,7 @@ class LivingCaveDefenseBlocks {
keys.removeIf { staticBlocks.any { others -> others.location.distance(it.location) < 1.5 } }
}
+ val location = event.location.add(-0.5, 0.0, -0.5)
// Ignore particles around blocks
if (staticBlocks.any { it.location.distance(location) < 3 }) {
@@ -148,11 +135,6 @@ class LivingCaveDefenseBlocks {
@SubscribeEvent
fun onRenderWorld(event: RenderWorldLastEvent) {
-// for (location in helpLocation) {
-// event.drawWaypointFilled(location, LorenzColor.GREEN.toColor())
-// event.drawDynamicText(location, "§aTest", 1.5)
-//
-// }
if (!isEnabled()) return
@@ -172,15 +154,15 @@ class LivingCaveDefenseBlocks {
}
for (block in staticBlocks) {
val location = block.location
+ event.drawDynamicText(location, "§bBreak!", 1.5, ignoreBlocks = false)
event.drawWaypointFilled(location, color)
- event.drawDynamicText(location, "§bBreak!", 1.5)
event.draw3DLine(
block.entity.getLorenzVec().add(0.0, 0.5, 0.0),
location.add(0.5, 0.5, 0.5),
color,
3,
- false
+ true,
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt
new file mode 100644
index 000000000..f83a9dfd6
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt
@@ -0,0 +1,101 @@
+package at.hannibal2.skyhanni.features.rift.everywhere
+
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
+import at.hannibal2.skyhanni.utils.LorenzUtils.round
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import net.minecraft.client.Minecraft
+import net.minecraft.util.EnumParticleTypes
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class RiftMotesOrb {
+ private val config get() = RiftAPI.config.motesOrbsConfig
+ private var motesOrbs = emptyList<MotesOrb>()
+ private val pattern = "§5§lORB! §r§dPicked up §r§5+.* Motes§r§d.*".toPattern()
+
+ class MotesOrb(
+ var location: LorenzVec,
+ var counter: Int = 0,
+ var startTime: Long = System.currentTimeMillis(),
+ var lastTime: Long = System.currentTimeMillis(),
+ var isOrb: Boolean = false,
+ var pickedUp: Boolean = false,
+ )
+
+ @SubscribeEvent
+ fun onReceiveParticle(event: ReceiveParticleEvent) {
+ if (!isEnabled()) return
+ val location = event.location.add(-0.5, 0.0, -0.5)
+
+ if (event.type == EnumParticleTypes.SPELL_MOB) {
+ val orb =
+ motesOrbs.find { it.location.distance(location) < 3 } ?: MotesOrb(location).also {
+ motesOrbs = motesOrbs.editCopy { add(it) }
+ }
+
+ orb.location = location
+ orb.lastTime = System.currentTimeMillis()
+ orb.counter++
+ orb.pickedUp = false
+ if (config.hideParticles && orb.isOrb) {
+ event.isCanceled = true
+ }
+ }
+
+
+ // TODO remove
+ Minecraft.getMinecraft().thePlayer?.let {
+ if (it.isSneaking) {
+ motesOrbs = emptyList()
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ pattern.matchMatcher(event.message) {
+ motesOrbs.minByOrNull { it.location.distanceToPlayer() }?.let {
+ it.pickedUp = true
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ if (!isEnabled()) return
+
+ motesOrbs = motesOrbs.editCopy { removeIf { System.currentTimeMillis() > it.lastTime + 2000 } }
+
+ for (orb in motesOrbs) {
+ val ageInSeconds = (System.currentTimeMillis() - orb.startTime).toDouble() / 1000
+ if (ageInSeconds < 0.5) continue
+
+ val particlesPerSecond = (orb.counter.toDouble() / ageInSeconds).round(1)
+ if (particlesPerSecond < 60 || particlesPerSecond > 90) continue
+ orb.isOrb = true
+
+ if (System.currentTimeMillis() > orb.lastTime + 300) {
+ orb.pickedUp = true
+ }
+
+ val location = orb.location
+
+ if (orb.pickedUp) {
+ event.drawDynamicText(location.add(0.0, 0.5, 0.0), "§7Motes Orb", 1.5, ignoreBlocks = false)
+ event.drawWaypointFilled(location, LorenzColor.GRAY.toColor())
+ } else {
+ event.drawDynamicText(location.add(0.0, 0.5, 0.0), "§dMotes Orb", 1.5, ignoreBlocks = false)
+ event.drawWaypointFilled(location, LorenzColor.LIGHT_PURPLE.toColor())
+ }
+ }
+ }
+
+ fun isEnabled() = RiftAPI.inRift() && config.enabled
+}
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 970a7f1dc..12e66c313 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
@@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.features.slayer
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
-import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
+import at.hannibal2.skyhanni.events.ServerBlockChangeEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
@@ -15,7 +15,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.init.Blocks
-import net.minecraft.network.play.server.S23PacketBlockChange
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -81,25 +80,22 @@ class EndermanSlayerBeacon {
}
}
- @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onPacketReceive(event: PacketEvent.ReceiveEvent) {
+ @SubscribeEvent
+ fun onBlockChange(event: ServerBlockChangeEvent) {
if (!isEnabled()) return
- val packet = event.packet
- if (packet is S23PacketBlockChange) {
- val location = packet.blockPosition.toLorenzVec()
- if (packet.blockState?.block == Blocks.beacon) {
- val armorStand = flyingBeacons.find { location.distance(it.getLorenzVec()) < 3 }
- if (armorStand != null) {
- flyingBeacons.remove(armorStand)
- sittingBeacon.add(location)
- logger.log("Replaced flying beacon with sitting beacon at $location")
- }
- } else {
- if (location in sittingBeacon) {
- logger.log("Removed sitting beacon $location")
- sittingBeacon.remove(location)
- }
+ val location = event.location
+ if (event.new == "beacon") {
+ val armorStand = flyingBeacons.find { location.distance(it.getLorenzVec()) < 3 }
+ if (armorStand != null) {
+ flyingBeacons.remove(armorStand)
+ sittingBeacon.add(location)
+ logger.log("Replaced flying beacon with sitting beacon at $location")
+ }
+ } else {
+ if (location in sittingBeacon) {
+ logger.log("Removed sitting beacon $location")
+ sittingBeacon.remove(location)
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 66cbb79b1..a6efd2355 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -812,7 +812,8 @@ object RenderUtils {
}
fun RenderWorldLastEvent.draw3DLine(
- p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean, targetColor: Color? = null
+ p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean, targetColor: Color? = null,
+ seeThroughBlocks: Boolean = true
) {
val render = Minecraft.getMinecraft().renderViewEntity
val worldRenderer = Tessellator.getInstance().worldRenderer
@@ -820,7 +821,9 @@ object RenderUtils {
val realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks
val realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks
GlStateManager.pushMatrix()
- GlStateManager.disableDepth()
+ if (!seeThroughBlocks) {
+ GlStateManager.disableDepth()
+ }
GlStateManager.disableCull()
GlStateManager.disableLighting()
GlStateManager.translate(-realX, -realY, -realZ)
@@ -853,6 +856,9 @@ object RenderUtils {
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f)
GlStateManager.popMatrix()
GlStateManager.disableLighting()
+ if (!seeThroughBlocks) {
+ GlStateManager.enableDepth()
+ }
}
fun RenderWorldLastEvent.exactLocation(entity: Entity): LorenzVec {