diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt new file mode 100644 index 000000000..1493e7a8c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt @@ -0,0 +1,19 @@ +package at.hannibal2.skyhanni.api + +import at.hannibal2.skyhanni.events.DataWatcherUpdatedEvent +import at.hannibal2.skyhanni.events.EntityCustomNameUpdateEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class DataWatcherAPI { + + 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() + } + } + } +} |
