blob: 94931dd8caf83ec59aa47dcde181bce4e9290744 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package at.hannibal2.skyhanni.api
import at.hannibal2.skyhanni.events.DataWatcherUpdatedEvent
import at.hannibal2.skyhanni.events.EntityCustomNameUpdateEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object DataWatcherAPI {
private val DATA_VALUE_CUSTOM_NAME = 2
@SubscribeEvent
fun onDataWatcherUpdate(event: DataWatcherUpdatedEvent) {
for (updatedEntry in event.updatedEntries) {
if (updatedEntry.dataValueId == DATA_VALUE_CUSTOM_NAME) {
EntityCustomNameUpdateEvent(event.entity.customNameTag, event.entity).postAndCatch()
}
}
}
// TODO move EntityHealthUpdateEvent logic from EntityData in here
}
|