Add GatherTooltipsEvent to AndroidResearch

This commit is contained in:
DBotThePony 2023-06-20 21:28:01 +07:00
parent da89401985
commit 070b962df9
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -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<Component>) : 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
}