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