Package com.jozufozu.flywheel.light
Class LightVolume
java.lang.Object
com.jozufozu.flywheel.light.LightVolume
- All Implemented Interfaces:
LightListener,ImmutableBox
- Direct Known Subclasses:
GPULightVolume
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GridAlignedBBprotected final net.minecraft.world.level.BlockAndTintGetterprotected ByteBuffer -
Constructor Summary
ConstructorsConstructorDescriptionLightVolume(net.minecraft.world.level.BlockAndTintGetter level, ImmutableBox sampleVolume) -
Method Summary
Modifier and TypeMethodDescriptionprotected intboxPosToBufferIndex(int x, int y, int z) voidcopyBlock(ImmutableBox worldVolume) Copy block light from the world into this volume.voidcopyLight(ImmutableBox worldVolume) Copy all light from the world into this volume.voidcopySky(ImmutableBox worldVolume) Copy sky light from the world into this volume.voiddelete()intgetMaxX()intgetMaxY()intgetMaxZ()intgetMinX()intgetMinY()intgetMinZ()shortgetPackedLight(int x, int y, int z) voidCompletely (re)populate this volume with block and sky lighting data.booleanCheck the status of the light listener.protected voidvoidmove(ImmutableBox newSampleVolume) voidonLightPacket(int chunkX, int chunkZ) Called when the server sends light data to the client.voidonLightUpdate(net.minecraft.world.level.LightLayer type, ImmutableBox changedVolume) Called when a light updates in a chunk the implementor cares about.protected voidsetBox(ImmutableBox box) protected intworldPosToBufferIndex(int x, int y, int z) protected voidwriteBlock(int x, int y, int z, int block) protected voidwriteLight(int x, int y, int z, int block, int sky) protected voidwriteSky(int x, int y, int z, int sky) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jozufozu.flywheel.util.box.ImmutableBox
contains, contains, copy, empty, forEachContained, hasPowerOf2Sides, intersect, intersects, intersects, isContainedBy, sameAs, sameAs, sameAs, sizeX, sizeY, sizeZ, toAABB, union, volume
-
Field Details
-
level
protected final net.minecraft.world.level.BlockAndTintGetter level -
box
-
lightData
-
-
Constructor Details
-
LightVolume
-
-
Method Details
-
setBox
-
getPackedLight
public short getPackedLight(int x, int y, int z) -
getMinX
public int getMinX()- Specified by:
getMinXin interfaceImmutableBox
-
getMinY
public int getMinY()- Specified by:
getMinYin interfaceImmutableBox
-
getMinZ
public int getMinZ()- Specified by:
getMinZin interfaceImmutableBox
-
getMaxX
public int getMaxX()- Specified by:
getMaxXin interfaceImmutableBox
-
getMaxY
public int getMaxY()- Specified by:
getMaxYin interfaceImmutableBox
-
getMaxZ
public int getMaxZ()- Specified by:
getMaxZin interfaceImmutableBox
-
move
-
onLightUpdate
Description copied from interface:LightListenerCalled when a light updates in a chunk the implementor cares about.- Specified by:
onLightUpdatein interfaceLightListener
-
onLightPacket
public void onLightPacket(int chunkX, int chunkZ) Description copied from interface:LightListenerCalled when the server sends light data to the client.- Specified by:
onLightPacketin interfaceLightListener
-
initialize
public void initialize()Completely (re)populate this volume with block and sky lighting data. This is expensive and should be avoided. -
copyBlock
Copy block light from the world into this volume.- Parameters:
worldVolume- the region in the world to copy data from.
-
copySky
Copy sky light from the world into this volume.- Parameters:
worldVolume- the region in the world to copy data from.
-
copyLight
Copy all light from the world into this volume.- Parameters:
worldVolume- the region in the world to copy data from.
-
delete
public void delete() -
markDirty
protected void markDirty() -
writeLight
protected void writeLight(int x, int y, int z, int block, int sky) -
writeBlock
protected void writeBlock(int x, int y, int z, int block) -
writeSky
protected void writeSky(int x, int y, int z, int sky) -
worldPosToBufferIndex
protected int worldPosToBufferIndex(int x, int y, int z) -
boxPosToBufferIndex
protected int boxPosToBufferIndex(int x, int y, int z) -
getVolume
- Specified by:
getVolumein interfaceLightListener
-
isListenerInvalid
public boolean isListenerInvalid()Description copied from interface:LightListenerCheck the status of the light listener.- Specified by:
isListenerInvalidin interfaceLightListener- Returns:
trueif the listener is invalid/removed/deleted, and should no longer receive updates.
-