Interface LitVisual
- All Superinterfaces:
Visual
- All Known Implementing Classes:
AbstractBlockEntityVisual,BellVisual,ChestVisual,ShulkerBoxVisual
If your visual moves around in the level at all, you should use TickableVisual or DynamicVisual,
and poll for light yourself along with listening for updates. When your visual moves to a different section, call
LitVisual.Notifier.notifySectionsChanged().
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA notifier object that can be used to indicate to the impl that the sections a visual is contained in have changed. -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectLightSections(LongConsumer consumer) Collect the sections that this visual is contained in.voidinitLightSectionNotifier(LitVisual.Notifier notifier) Set the notifier object.voidCalled when a section this visual is contained in receives a light update.
-
Method Details
-
updateLight
void updateLight()Called when a section this visual is contained in receives a light update.Even if multiple sections are updated at the same time, this method will only be called once.
The implementation is free to parallelize calls to this method, as well as execute the plan returned by
DynamicVisual.planFrame()simultaneously. It is safe to query/update light here, but you must ensure proper synchronization if you want to mutate anything outside this visual or anything that is also mutated withinDynamicVisual.planFrame(). -
collectLightSections
Collect the sections that this visual is contained in.This method is called upon visual creation, and the frame after
LitVisual.Notifier.notifySectionsChanged()is called.- Parameters:
consumer- The consumer to provide the sections to.- See Also:
-
SectionPos.asLong(net.minecraft.core.BlockPos)
-
initLightSectionNotifier
Set the notifier object.This method is only called once, upon visual creation, after
Visual.init(float)and beforecollectLightSections(java.util.function.LongConsumer).- Parameters:
notifier- The notifier.
-