aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/OwnInventorItemUpdateEvent.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt5
3 files changed, 24 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/OwnInventorItemUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/OwnInventorItemUpdateEvent.kt
index d9b641cee..892651a3d 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/OwnInventorItemUpdateEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/OwnInventorItemUpdateEvent.kt
@@ -2,4 +2,7 @@ package at.hannibal2.skyhanni.events
import net.minecraft.item.ItemStack
-class OwnInventorItemUpdateEvent(val itemStack: ItemStack): LorenzEvent() \ No newline at end of file
+/**
+ * Note: This event is async and may not be executed on the main minecraft thread.
+ */
+data class OwnInventorItemUpdateEvent(val itemStack: ItemStack): LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt
index abdb79b39..71c1cfa73 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt
@@ -4,19 +4,25 @@ import net.minecraft.network.Packet
import net.minecraftforge.fml.common.eventhandler.Cancelable
@Cancelable
-open class PacketEvent(val packet: Packet<*>) : LorenzEvent() {
- var direction: Direction? = null
+/**
+ * Note: This event is async and may not be executed on the main minecraft thread.
+ */
+abstract class PacketEvent : LorenzEvent() {
+ abstract val direction: Direction
+ abstract val packet: Packet<*>
- class ReceiveEvent(packet: Packet<*>) : PacketEvent(packet) {
- init {
- direction = Direction.INBOUND
- }
+ /**
+ * Note: This event is async and may not be executed on the main minecraft thread.
+ */
+ data class ReceiveEvent(override val packet: Packet<*>) : PacketEvent() {
+ override val direction = Direction.INBOUND
}
- class SendEvent(packet: Packet<*>) : PacketEvent(packet) {
- init {
- direction = Direction.OUTBOUND
- }
+ /**
+ * Note: This event is async and may not be executed on the main minecraft thread.
+ */
+ data class SendEvent(override val packet: Packet<*>) : PacketEvent() {
+ override val direction = Direction.OUTBOUND
}
enum class Direction {
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 17adc4f2c..c339a5425 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
@@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
+import io.github.moulberry.notenoughupdates.util.MinecraftExecutor
import io.github.moulberry.notenoughupdates.util.SBInfo
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiEditSign
@@ -203,7 +204,9 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onOwnInventoryItemUpdate(event: OwnInventorItemUpdateEvent) {
if (GardenAPI.onBarnPlot) {
- update()
+ MinecraftExecutor.OnThread.execute {
+ update()
+ }
}
}