aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-06-17 22:46:18 +1000
committerGitHub <noreply@github.com>2023-06-17 14:46:18 +0200
commit210acc597ffa1b1213ebd7482d03b13670e4cee5 (patch)
tree7849355a1e9959cdd57d02f6417091a9e53ce8c8 /src/main/java/at/hannibal2
parentf5d7d265b8139f1c948a7408b6313673ed8bfe81 (diff)
downloadskyhanni-210acc597ffa1b1213ebd7482d03b13670e4cee5.tar.gz
skyhanni-210acc597ffa1b1213ebd7482d03b13670e4cee5.tar.bz2
skyhanni-210acc597ffa1b1213ebd7482d03b13670e4cee5.zip
made barn area a bounding box (#237)
Diffstat (limited to 'src/main/java/at/hannibal2')
-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