aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-04 14:33:39 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-04 14:33:39 +0200
commit0a29213e7b22dd3673138a7283a8ac97fc133aed (patch)
tree70b7ffdb6d069cfb160b6e3c505215fb31dafe66 /src/main/java/at/hannibal2
parentf9b645ec52f44548ec8197190373ccae4335bae2 (diff)
downloadskyhanni-0a29213e7b22dd3673138a7283a8ac97fc133aed.tar.gz
skyhanni-0a29213e7b22dd3673138a7283a8ac97fc133aed.tar.bz2
skyhanni-0a29213e7b22dd3673138a7283a8ac97fc133aed.zip
isVecInside support for LorenzVec, and added isPlayerInside
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt5
4 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
index b01f662a9..0a51cbd92 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice
import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.MinecraftDispatcher
@@ -61,7 +62,7 @@ object GardenAPI {
if (!inGarden()) return
tick++
if (tick % 10 == 0) {
- inBarn = barnArea.isVecInside(Minecraft.getMinecraft().thePlayer.positionVector)
+ inBarn = barnArea.isPlayerInside()
// We ignore random hypixel moments
Minecraft.getMinecraft().currentScreen ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt
index 63667888e..11eceb704 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt
@@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
import at.hannibal2.skyhanni.utils.jsonobjects.DanceRoomInstructionsJson
import kotlinx.coroutines.*
-import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.util.AxisAlignedBB
import net.minecraftforge.event.world.WorldEvent
@@ -74,7 +74,7 @@ object DanceRoomHelper {
fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
if (event.isMod(10)) {
- inRoom = danceRoom.isVecInside(Minecraft.getMinecraft().thePlayer.positionVector)
+ inRoom = danceRoom.isPlayerInside()
}
if (inRoom) {
update()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt
index 04f26c932..ff19e52fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt
@@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.rift
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
-import net.minecraft.client.Minecraft
import net.minecraft.util.AxisAlignedBB
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -17,7 +17,7 @@ class LaserParkour {
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!RiftAPI.inRift()) return
if (!config.laserParkour) return
- if (!puzzleRoom.isVecInside(Minecraft.getMinecraft().thePlayer.positionVector)) return
+ if (!puzzleRoom.isPlayerInside()) return
for (location in locations) {
event.drawWaypointFilled(location, LorenzColor.GREEN.toColor())
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
index 510f631b6..bf7a0f1ee 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import net.minecraft.client.Minecraft
import net.minecraft.entity.Entity
+import net.minecraft.util.AxisAlignedBB
object LocationUtils {
@@ -20,4 +21,8 @@ object LocationUtils {
val vec = player.getLorenzVec()
return vec.add(0.0, 0.0 + player.getEyeHeight(), 0.0)
}
+
+ fun AxisAlignedBB.isVecInside(vec: LorenzVec) = isVecInside(vec.toVec3())
+
+ fun AxisAlignedBB.isPlayerInside() = isVecInside(playerLocation())
} \ No newline at end of file