aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt2
2 files changed, 5 insertions, 4 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 dbf3486b3..b01f662a9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.ProfileStorageData
-import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.CropType.Companion.getCropType
import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay
@@ -25,6 +24,7 @@ import kotlinx.coroutines.withContext
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
import net.minecraft.network.play.client.C09PacketHeldItemChange
+import net.minecraft.util.AxisAlignedBB
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -35,11 +35,12 @@ object GardenAPI {
var itemInHand: ItemStack? = null
var cropInHand: CropType? = null
var mushroomCowPet = false
- var inBarn = false
+ private var inBarn = false
val onBarnPlot get() = inBarn && inGarden()
val config get() = ProfileStorageData.profileSpecific?.garden
var tick = 0
+ private val barnArea = AxisAlignedBB(35.5, 70.0, -4.5, -32.5, 100.0, -46.5)
@SubscribeEvent
fun onSendPacket(event: PacketEvent.SendEvent) {
@@ -60,7 +61,7 @@ object GardenAPI {
if (!inGarden()) return
tick++
if (tick % 10 == 0) {
- inBarn = ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §aThe Garden")
+ inBarn = barnArea.isVecInside(Minecraft.getMinecraft().thePlayer.positionVector)
// We ignore random hypixel moments
Minecraft.getMinecraft().currentScreen ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index b3fcf412e..973f122d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -324,7 +324,7 @@ class GardenVisitorFeatures {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onTooltip(event: ItemTooltipEvent) {
- if (!GardenAPI.inBarn) return
+ if (!GardenAPI.onBarnPlot) return
if (!inVisitorInventory) return
if (event.itemStack.name != "§aAccept Offer") return