Misc improvements

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-13 23:30:16 +01:00
parent 615f8e7edd
commit e56d82eb2a
3 changed files with 4 additions and 11 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);
}