Search in sources :

Example 1 with ChunkHolder

use of net.minecraft.server.level.ChunkHolder in project Denizen-For-Bukkit by DenizenScript.

the class ChunkHelperImpl method refreshChunkSections.

@Override
public void refreshChunkSections(Chunk chunk) {
    ClientboundLevelChunkPacket packet = new ClientboundLevelChunkPacket(((CraftChunk) chunk).getHandle());
    ChunkPos pos = new ChunkPos(chunk.getX(), chunk.getZ());
    ChunkHolder playerChunk = ((CraftWorld) chunk.getWorld()).getHandle().getChunkProvider().chunkMap.l.get(pos.toLong());
    if (playerChunk == null) {
        return;
    }
    playerChunk.playerProvider.getPlayers(pos, false).forEach(player -> {
        player.connection.send(packet);
    });
}
Also used : ChunkHolder(net.minecraft.server.level.ChunkHolder) ChunkPos(net.minecraft.world.level.ChunkPos) ClientboundLevelChunkPacket(net.minecraft.network.protocol.game.ClientboundLevelChunkPacket) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld)

Aggregations

ClientboundLevelChunkPacket (net.minecraft.network.protocol.game.ClientboundLevelChunkPacket)1 ChunkHolder (net.minecraft.server.level.ChunkHolder)1 ChunkPos (net.minecraft.world.level.ChunkPos)1 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)1