BlockLightSectionStorage .java

net.minecraft.world.level.lighting.BlockLightSectionStorage (class): members: BlockDataLayerStorageMap, getLightValue. imports: LightChunkGetter, BlockPos.

net.minecraft.world.level.lightingclass38 linescommonextends LayerLightSectionStorage<BlockLightSectionStorage.BlockDataLayerStorageMap>1.4 KB

API Surface (2)

int getLightValue(final long blockNode)
BlockLightSectionStorage.BlockDataLayerStorageMap copy()

Code Graph: Dependencies (7)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BlockLightSectionStorage.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.lighting;
2
3
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.SectionPos;
6
import net.minecraft.world.level.LightLayer;
7
import net.minecraft.world.level.chunk.DataLayer;
8
import net.minecraft.world.level.chunk.LightChunkGetter;
9
10
public class BlockLightSectionStorage extends LayerLightSectionStorage<BlockLightSectionStorage.BlockDataLayerStorageMap> {
11
	protected BlockLightSectionStorage(final LightChunkGetter chunkSource) {
12
		super(LightLayer.BLOCK, chunkSource, new BlockLightSectionStorage.BlockDataLayerStorageMap(new Long2ObjectOpenHashMap<>()));
13
	}
14
15
	@Override
16
	protected int getLightValue(final long blockNode) {
17
		long sectionNode = SectionPos.blockToSection(blockNode);
18
		DataLayer layer = this.getDataLayer(sectionNode, false);
19
		return layer == null
20
			? 0
21
			: layer.get(
22
				SectionPos.sectionRelative(BlockPos.getX(blockNode)),
23
				SectionPos.sectionRelative(BlockPos.getY(blockNode)),
24
				SectionPos.sectionRelative(BlockPos.getZ(blockNode))
25
			);
26
	}
27
28
	protected static final class BlockDataLayerStorageMap extends DataLayerStorageMap<BlockLightSectionStorage.BlockDataLayerStorageMap> {
29
		public BlockDataLayerStorageMap(final Long2ObjectOpenHashMap<DataLayer> map) {
30
			super(map);
31
		}
32
33
		public BlockLightSectionStorage.BlockDataLayerStorageMap copy() {
34
			return new BlockLightSectionStorage.BlockDataLayerStorageMap(this.map.clone());
35
		}
36
	}
37
}
38

Decompiled Minecraft 26.3 source of BlockLightSectionStorage (net/minecraft/world/level/lighting/BlockLightSectionStorage.java) with Mojang official mappings, stored verbatim on the site.