aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
index 9ed976764..8b6ce2ad3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -18,10 +19,12 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.RecalculatingValue
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
object HoppityEggLocator {
@@ -30,6 +33,8 @@ object HoppityEggLocator {
private val locatorItem = "EGGLOCATOR".asInternalName()
private var lastParticlePosition: LorenzVec? = null
+ private var lastParticlePositionForever: LorenzVec? = null
+ private var lastChange = SimpleTimeMark.farPast()
private val validParticleLocations = mutableListOf<LorenzVec>()
private var drawLocations = false
@@ -69,8 +74,22 @@ object HoppityEggLocator {
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return
- event.draw3DLine(firstPos, secondPos, LorenzColor.RED.toColor(), 2, false)
-
+ val eyeLocation = event.exactPlayerEyeLocation()
+ lastParticlePositionForever?.let {
+ if (lastChange.passedSince() < 300.milliseconds) {
+ if (eyeLocation.distance(it) > 2) {
+ event.drawWaypointFilled(
+ it,
+ LorenzColor.GREEN.toColor(),
+ seeThroughBlocks = true,
+ )
+ event.drawDynamicText(it.add(y = 1), "§aGuess", 1.5)
+ }
+ if (!drawLocations) {
+ event.draw3DLine(eyeLocation, it.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false)
+ }
+ }
+ }
if (drawLocations) {
for ((index, eggLocation) in possibleEggLocations.withIndex()) {
val eggLabel = "§aGuess #${index + 1}"
@@ -80,6 +99,7 @@ object HoppityEggLocator {
seeThroughBlocks = true,
)
event.drawDynamicText(eggLocation.add(y = 1), eggLabel, 1.5)
+ event.draw3DLine(eyeLocation, eggLocation.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false)
}
return
}
@@ -118,10 +138,13 @@ object HoppityEggLocator {
fun onReceiveParticle(event: ReceiveParticleEvent) {
if (!isEnabled()) return
if (!hasLocatorInInventory()) return
+ if (GardenAPI.inGarden()) return
if (!event.isVillagerParticle() && !event.isEnchantmentParticle()) return
val lastParticlePosition = lastParticlePosition ?: run {
lastParticlePosition = event.location
+ lastParticlePositionForever = lastParticlePosition
+ lastChange = SimpleTimeMark.now()
return
}
if (lastParticlePosition == event.location) {