#Detect Enhanced Celestials Lunar Event

3 messages · Page 1 of 1 (latest)

storm forum
#

Run /kjs custom_command and it will print out the current lunar event ID in chat. Feel free to modify or use for your own scripts, I don't care about credit. It took me way too long to figure this out so I don't want anyone else to have to.

const $TrackedDataKey = Java.loadClass('dev.corgitaco.dataanchor.data.registry.TrackedDataKey')
const $TrackedDataRegistry = Java.loadClass('dev.corgitaco.dataanchor.data.registry.TrackedDataRegistry')

ServerEvents.customCommand('checkLunarEvent', event => {
    let key = $TrackedDataKey.fromID($TrackedDataRegistry.of('dataanchor:level'), 'enhancedcelestials:lunar_forecast')
    event.player.tell(event.level.dataAnchor$getTrackedData(key).get().currentLunarEventHolder().unwrapKey().get().location())
})
#

soooo happy i figured this out

#
const $TrackedDataKey = Java.loadClass('dev.corgitaco.dataanchor.data.registry.TrackedDataKey')
const $TrackedDataRegistry = Java.loadClass('dev.corgitaco.dataanchor.data.registry.TrackedDataRegistry')

ItemEvents.rightClicked('minecraft:paper', event => {
    let key = $TrackedDataKey.fromID($TrackedDataRegistry.of('dataanchor:level'), 'enhancedcelestials:lunar_forecast')
    event.player.tell(event.level.dataAnchor$getTrackedData(key).get().currentLunarEventHolder().unwrapKey().get().location())
})

Same thing but activates when you right click paper instead since custom_command isnt a thing in 1.21.1