mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 03:27:56 +01:00
Misc improvements
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
615f8e7edd
commit
e56d82eb2a
@ -73,7 +73,7 @@ public class AnvilLoader implements IChunkLoader {
|
||||
}
|
||||
try {
|
||||
return loadMCA(instance, chunkX, chunkZ);
|
||||
} catch (IOException | AnvilException e) {
|
||||
} catch (Exception e) {
|
||||
EXCEPTION_MANAGER.handleException(e);
|
||||
}
|
||||
return CompletableFuture.completedFuture(null);
|
||||
|
@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.minestom.server.instance.Chunk.CHUNK_SECTION_SIZE;
|
||||
|
||||
final class PaletteImpl implements Palette {
|
||||
final class PaletteImpl implements Palette, Cloneable {
|
||||
// Magic values generated with "Integer.MAX_VALUE >> (31 - bitsPerIndex)" for bitsPerIndex between 1 and 16
|
||||
private static final int[] MAGIC_MASKS =
|
||||
{0, 1, 3, 7,
|
||||
@ -152,16 +152,10 @@ final class PaletteImpl implements Palette {
|
||||
// Palette
|
||||
if (bitsPerEntry < 9) {
|
||||
// Palette has to exist
|
||||
writer.writeVarInt(lastPaletteIndex);
|
||||
for (int i = 0; i < lastPaletteIndex; i++) {
|
||||
writer.writeVarInt(paletteToValueList.getInt(i));
|
||||
}
|
||||
writer.writeVarIntList(paletteToValueList, BinaryWriter::writeVarInt);
|
||||
}
|
||||
// Raw
|
||||
writer.writeVarInt(values.length);
|
||||
for (long datum : values) {
|
||||
writer.writeLong(datum);
|
||||
}
|
||||
writer.writeLongArray(values);
|
||||
}
|
||||
|
||||
private int fixBitsPerEntry(int bitsPerEntry) {
|
||||
|
@ -19,7 +19,6 @@ import java.util.Objects;
|
||||
public record ChunkData(@NotNull NBTCompound heightmaps, byte @NotNull [] data,
|
||||
@NotNull Map<Integer, Block> blockEntities) implements Writeable {
|
||||
public ChunkData {
|
||||
data = data.clone();
|
||||
blockEntities = Map.copyOf(blockEntities);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user