<commit_before>package think.webglmap.bukkit;

import io.netty.buffer.ByteBuf;
import org.bukkit.ChunkSnapshot;
import org.bukkit.World;

import java.util.concurrent.*;

public class ChunkManager {

    private final WebglMapPlugin plugin;
    private final World world;

    public ChunkManager(WebglMapPlugin plugin, World world) {
        this.plugin = plugin;
        this.world = world;
    }

    private static long chunkKey(int x, int z) {
        return ((long) x << 32) | z & 0xFFFFFFFL;
    }

    public void cleanup() {
    }

    public boolean getChunkBytes(final int x, final int z, ByteBuf out) {
        ChunkSnapshot chunk = null;
        try {
            chunk = plugin.getServer().getScheduler().callSyncMethod(plugin, new Callable<ChunkSnapshot>() {
                @Override
                public ChunkSnapshot call() throws Exception {
                    return world.getChunkAt(x, z).getChunkSnapshot(false, true, false);
                }
            }).get();
        } catch (InterruptedException e) {
            Thread.interrupted();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
        if (chunk == null) {
            return false;
        }
        int mask = 0;
        for (int i = 0; i < 16; i++) {
            if (!chunk.isSectionEmpty(i))
                mask |= 1 << i;
        }
        out.writeInt(x);
        out.writeInt(z);
        out.writeShort(mask);
        for (int i = 0; i < 16; i++) {
            if (!chunk.isSectionEmpty(i)) {
                for (int oy = 0; oy < 16; oy++) {
                    for (int oz = 0; oz < 16; oz++) {
                        for (int ox = 0; ox < 16; ox++) {
                            out.writeShort(chunk.getBlockTypeId(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockData(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockEmittedLight(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockSkyLight(ox, oy + i * 16, oz));
                        }<commit_msg>Don't generate new chunks<commit_after>package think.webglmap.bukkit;

import io.netty.buffer.ByteBuf;
import org.bukkit.ChunkSnapshot;
import org.bukkit.World;

import java.util.concurrent.*;

public class ChunkManager {

    private final WebglMapPlugin plugin;
    private final World world;

    public ChunkManager(WebglMapPlugin plugin, World world) {
        this.plugin = plugin;
        this.world = world;
    }

    private static long chunkKey(int x, int z) {
        return ((long) x << 32) | z & 0xFFFFFFFL;
    }

    public void cleanup() {
    }

    public boolean getChunkBytes(final int x, final int z, ByteBuf out) {
        ChunkSnapshot chunk = null;
        try {
            chunk = plugin.getServer().getScheduler().callSyncMethod(plugin, new Callable<ChunkSnapshot>() {
                @Override
                public ChunkSnapshot call() throws Exception {
                    if (!world.loadChunk(x, z, false)) {
                        return null;
                    }
                    return world.getChunkAt(x, z).getChunkSnapshot(false, true, false);
                }
            }).get();
        } catch (InterruptedException e) {
            Thread.interrupted();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
        if (chunk == null) {
            return false;
        }
        int mask = 0;
        for (int i = 0; i < 16; i++) {
            if (!chunk.isSectionEmpty(i))
                mask |= 1 << i;
        }
        out.writeInt(x);
        out.writeInt(z);
        out.writeShort(mask);
        for (int i = 0; i < 16; i++) {
            if (!chunk.isSectionEmpty(i)) {
                for (int oy = 0; oy < 16; oy++) {
                    for (int oz = 0; oz < 16; oz++) {
                        for (int ox = 0; ox < 16; ox++) {
                            out.writeShort(chunk.getBlockTypeId(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockData(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockEmittedLight(ox, oy + i * 16, oz));
                            out.writeByte(chunk.getBlockSkyLight(ox, oy + i * 16, oz));
                        }
{'fraction_non_alphanumeric': 0.11693171188026193, 'fraction_numerical': 0.013096351730589336, 'mean_word_length': 1.5780590717299579, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6200657', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1203, 'n_words': 323}