diff options
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 |