From 070b962df91c3e108d2f97a9d2aeeb10a47a7b20 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 20 Jun 2023 21:28:01 +0700 Subject: [PATCH] Add GatherTooltipsEvent to AndroidResearch --- .../ru/dbotthepony/mc/otm/android/AndroidResearch.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt index e092efa06..ad276b238 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt @@ -8,7 +8,9 @@ import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer import net.minecraft.world.entity.player.Player +import net.minecraftforge.common.MinecraftForge import net.minecraftforge.common.util.INBTSerializable +import net.minecraftforge.eventbus.api.Event import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.awareItemsStream @@ -249,6 +251,11 @@ class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlay return false } + /** + * Fired on main event bus each time research lines are being gathered + */ + data class GatherTooltipsEvent(val research: AndroidResearch, val tooltips: MutableList) : Event() + /** * List of all tooltip lines for this research */ @@ -260,6 +267,8 @@ class AndroidResearch(val type: AndroidResearchType, val capability: MatteryPlay line.addLines(this, lines) } + MinecraftForge.EVENT_BUS.post(GatherTooltipsEvent(this, lines)) + return lines }