mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Replaced CopyOnWriteArraySet to IntOpenHashSet for block entities
This commit is contained in:
parent
fcb59ff7e7
commit
0a5349226e
@ -26,9 +26,7 @@ import net.minestom.server.world.biomes.Biome;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
/**
|
||||
* Represents a {@link Chunk} which store each individual block in memory.
|
||||
@ -55,7 +53,7 @@ public class DynamicChunk extends Chunk {
|
||||
protected final Int2LongMap updatableBlocksLastUpdate = new Int2LongOpenHashMap();
|
||||
|
||||
// Block entities
|
||||
protected final Set<Integer> blockEntities = new CopyOnWriteArraySet<>();
|
||||
protected final IntSet blockEntities = new IntOpenHashSet();
|
||||
|
||||
private long lastChangeTime;
|
||||
|
||||
@ -389,7 +387,7 @@ public class DynamicChunk extends Chunk {
|
||||
fullDataPacket.chunkZ = chunkZ;
|
||||
fullDataPacket.paletteStorage = blockPalette.copy();
|
||||
fullDataPacket.customBlockPaletteStorage = customBlockPalette.copy();
|
||||
fullDataPacket.blockEntities = new HashSet<>(blockEntities);
|
||||
fullDataPacket.blockEntities = new IntOpenHashSet(blockEntities);
|
||||
fullDataPacket.blocksData = new Int2ObjectOpenHashMap<>(blocksData);
|
||||
return fullDataPacket;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.data.Data;
|
||||
import net.minestom.server.instance.block.BlockManager;
|
||||
@ -21,7 +22,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChunkDataPacket implements ServerPacket, CacheablePacket {
|
||||
@ -36,7 +36,7 @@ public class ChunkDataPacket implements ServerPacket, CacheablePacket {
|
||||
public PaletteStorage paletteStorage;
|
||||
public PaletteStorage customBlockPaletteStorage;
|
||||
|
||||
public Set<Integer> blockEntities;
|
||||
public IntSet blockEntities;
|
||||
public Int2ObjectMap<Data> blocksData;
|
||||
|
||||
public int[] sections;
|
||||
|
Loading…
Reference in New Issue
Block a user