Search in sources :

Example 1 with ClientboundLightUpdatePacket

use of net.minecraft.network.protocol.game.ClientboundLightUpdatePacket in project Denizen-For-Bukkit by DenizenScript.

the class BlockLightImpl method sendSingleChunkUpdate.

public static void sendSingleChunkUpdate(LevelChunk chunk) {
    doNotCheck = true;
    LevelLightEngine lightEngine = chunk.getLevel().getChunkSource().getLightEngine();
    ChunkPos pos = chunk.getPos();
    // TODO: 1.16: should 'trust edges' be true here?
    ClientboundLightUpdatePacket packet = new ClientboundLightUpdatePacket(pos, lightEngine, null, null, true);
    ((ServerChunkCache) chunk.getLevel().getChunkSource()).chunkMap.getPlayers(pos, false).forEach((player) -> {
        player.connection.send(packet);
    });
    doNotCheck = false;
}
Also used : ThreadedLevelLightEngine(net.minecraft.server.level.ThreadedLevelLightEngine) LevelLightEngine(net.minecraft.world.level.lighting.LevelLightEngine) ClientboundLightUpdatePacket(net.minecraft.network.protocol.game.ClientboundLightUpdatePacket) ChunkPos(net.minecraft.world.level.ChunkPos) ServerChunkCache(net.minecraft.server.level.ServerChunkCache)

Example 2 with ClientboundLightUpdatePacket

use of net.minecraft.network.protocol.game.ClientboundLightUpdatePacket in project Denizen-For-Bukkit by DenizenScript.

the class BlockLightImpl method sendSingleChunkUpdate.

public static void sendSingleChunkUpdate(LevelChunk chunk) {
    doNotCheck = true;
    LevelLightEngine lightEngine = chunk.getLevel().getChunkSource().getLightEngine();
    ChunkPos pos = chunk.getPos();
    // TODO: 1.16: should 'trust edges' be true here?
    ClientboundLightUpdatePacket packet = new ClientboundLightUpdatePacket(pos, lightEngine, null, null, true);
    ((ServerChunkCache) chunk.getLevel().getChunkSource()).chunkMap.getPlayers(pos, false).forEach((player) -> {
        player.connection.send(packet);
    });
    doNotCheck = false;
}
Also used : ThreadedLevelLightEngine(net.minecraft.server.level.ThreadedLevelLightEngine) LevelLightEngine(net.minecraft.world.level.lighting.LevelLightEngine) ClientboundLightUpdatePacket(net.minecraft.network.protocol.game.ClientboundLightUpdatePacket) ChunkPos(net.minecraft.world.level.ChunkPos) ServerChunkCache(net.minecraft.server.level.ServerChunkCache)

Aggregations

ClientboundLightUpdatePacket (net.minecraft.network.protocol.game.ClientboundLightUpdatePacket)2 ServerChunkCache (net.minecraft.server.level.ServerChunkCache)2 ThreadedLevelLightEngine (net.minecraft.server.level.ThreadedLevelLightEngine)2 ChunkPos (net.minecraft.world.level.ChunkPos)2 LevelLightEngine (net.minecraft.world.level.lighting.LevelLightEngine)2