blob: e7e7fd2b5ac348a4424fbe6cce744e3b66b246e3 (
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 const 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
}
|