Package com.jozufozu.flywheel.light
Class LightUpdater
java.lang.Object
com.jozufozu.flywheel.light.LightUpdater
- Direct Known Subclasses:
DummyLightUpdater
Keeps track of what chunks/sections each listener is in, so we can update exactly what needs to be updated.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LightListener listener) Add a listener.static longblockToSection(net.minecraft.core.BlockPos pos) static LightUpdaterget(net.minecraft.world.level.LevelAccessor level) booleanisEmpty()voidonLightPacket(int chunkX, int chunkZ) Dispatch light updates to all registeredLightListeners when the server sends lighting data for an entire chunk.voidonLightUpdate(net.minecraft.world.level.LightLayer type, long sectionPos) Dispatch light updates to all registeredLightListeners.voidremoveListener(LightListener listener) static longsectionToChunk(long sectionPos) voidtick()
-
Constructor Details
-
LightUpdater
public LightUpdater(net.minecraft.world.level.LevelAccessor level)
-
-
Method Details
-
get
-
tick
public void tick() -
addListener
Add a listener.- Parameters:
listener- The object that wants to receive light update notifications.
-
removeListener
-
onLightUpdate
public void onLightUpdate(net.minecraft.world.level.LightLayer type, long sectionPos) Dispatch light updates to all registeredLightListeners.- Parameters:
type- The type of light that changed.sectionPos- A long representing the section position where light changed.
-
onLightPacket
public void onLightPacket(int chunkX, int chunkZ) Dispatch light updates to all registeredLightListeners when the server sends lighting data for an entire chunk. -
blockToSection
public static long blockToSection(net.minecraft.core.BlockPos pos) -
sectionToChunk
public static long sectionToChunk(long sectionPos) -
getAllBoxes
-
isEmpty
public boolean isEmpty()
-