Search in sources :

Example 1 with PacketHeightmap

use of io.xol.chunkstories.net.packets.PacketHeightmap in project chunkstories by Hugobros3.

the class HeightmapImplementation method setSummaryData.

public void setSummaryData(int[] heightData, int[] voxelData) {
    // texturesUpToDate.set(false);
    // 512kb per summary, use of max mipmaps for heights
    heights = new int[(int) Math.ceil(256 * 256 * (1 + 1 / 3D))];
    ids = new int[(int) Math.ceil(256 * 256 * (1 + 1 / 3D))];
    System.arraycopy(heightData, 0, heights, 0, 256 * 256);
    System.arraycopy(voxelData, 0, ids, 0, 256 * 256);
    recomputeMetadata();
    summaryLoaded.set(true);
    if (world instanceof WorldClient) {
        ((WorldClient) world).getWorldRenderer().getSummariesTexturesHolder().warnDataHasArrived(regionX, regionZ);
    }
    // Already have clients waiting for it ? Satisfy these messieurs
    usersLock.lock();
    for (RemotePlayer user : usersWaitingForIntialData) {
        user.pushPacket(new PacketHeightmap(this));
    }
    usersWaitingForIntialData.clear();
    usersLock.unlock();
}
Also used : PacketHeightmap(io.xol.chunkstories.net.packets.PacketHeightmap) RemotePlayer(io.xol.chunkstories.api.server.RemotePlayer) WorldClient(io.xol.chunkstories.api.world.WorldClient)

Aggregations

RemotePlayer (io.xol.chunkstories.api.server.RemotePlayer)1 WorldClient (io.xol.chunkstories.api.world.WorldClient)1 PacketHeightmap (io.xol.chunkstories.net.packets.PacketHeightmap)1