Search in sources :

Example 6 with SectionLevelArray

use of thpmc.engine.util.SectionLevelArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method getSkyLightLevel.

@Override
public int getSkyLightLevel(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionLevelArray sectionLevelArray = skyLightArrays[sectionIndex];
    if (sectionLevelArray == null)
        return 0;
    return sectionLevelArray.getLevel(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
}
Also used : SectionLevelArray(thpmc.engine.util.SectionLevelArray)

Example 7 with SectionLevelArray

use of thpmc.engine.util.SectionLevelArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method hasBlockLight.

@Override
public boolean hasBlockLight(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionLevelArray sectionLevelArray = blockLightArrays[sectionIndex];
    if (sectionLevelArray == null)
        return false;
    return sectionLevelArray.contains(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
}
Also used : SectionLevelArray(thpmc.engine.util.SectionLevelArray)

Example 8 with SectionLevelArray

use of thpmc.engine.util.SectionLevelArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method removeSkyLight.

@Override
public void removeSkyLight(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionLevelArray sectionLevelArray = skyLightArrays[sectionIndex];
    if (sectionLevelArray == null)
        return;
    sectionLevelArray.remove(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
    lightUpdatePacketCache = null;
}
Also used : SectionLevelArray(thpmc.engine.util.SectionLevelArray)

Example 9 with SectionLevelArray

use of thpmc.engine.util.SectionLevelArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method setSkyLightLevel.

@Override
public void setSkyLightLevel(int blockX, int blockY, int blockZ, int level) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionLevelArray sectionLevelArray = skyLightArrays[sectionIndex];
    if (sectionLevelArray == null) {
        sectionLevelArray = new SectionLevelArray();
        skyLightArrays[sectionIndex] = sectionLevelArray;
    }
    sectionLevelArray.setLevel(blockX & 0xF, blockY & 0xF, blockZ & 0xF, (byte) level);
    lightUpdatePacketCache = null;
}
Also used : SectionLevelArray(thpmc.engine.util.SectionLevelArray)

Example 10 with SectionLevelArray

use of thpmc.engine.util.SectionLevelArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method hasSkyLight.

@Override
public boolean hasSkyLight(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionLevelArray sectionLevelArray = skyLightArrays[sectionIndex];
    if (sectionLevelArray == null)
        return false;
    return sectionLevelArray.contains(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
}
Also used : SectionLevelArray(thpmc.engine.util.SectionLevelArray)

Aggregations

SectionLevelArray (thpmc.engine.util.SectionLevelArray)15 ParallelChunk (thpmc.engine.api.world.parallel.ParallelChunk)3 ParallelWorld (thpmc.engine.api.world.parallel.ParallelWorld)3 World (org.bukkit.World)2 Nullable (org.jetbrains.annotations.Nullable)2 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)2 NibbleArray (net.minecraft.server.v1_15_R1.NibbleArray)1 PacketPlayOutLightUpdate (net.minecraft.server.v1_15_R1.PacketPlayOutLightUpdate)1 NibbleArray (net.minecraft.server.v1_16_R3.NibbleArray)1 PacketPlayOutLightUpdate (net.minecraft.server.v1_16_R3.PacketPlayOutLightUpdate)1 EnginePlayer (thpmc.engine.api.player.EnginePlayer)1 SectionTypeArray (thpmc.engine.util.SectionTypeArray)1