mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-27 01:06:39 +01:00
Convert ChunkUtils.ChunkData into a record
This commit is contained in:
parent
682e4b3edd
commit
52ef3d392a
2 changed files with 4 additions and 8 deletions
|
@ -69,7 +69,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
|
|||
return;
|
||||
}
|
||||
ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset);
|
||||
ChunkSection[] sections = chunkData.getSections();
|
||||
ChunkSection[] sections = chunkData.sections();
|
||||
|
||||
// Find highest section
|
||||
int sectionCount = sections.length - 1;
|
||||
|
@ -91,7 +91,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
|
|||
}
|
||||
size += 1; // Border blocks
|
||||
size += 1; // Extra data length (always 0)
|
||||
size += chunkData.getBlockEntities().length * 64; // Conservative estimate of 64 bytes per tile entity
|
||||
size += chunkData.blockEntities().length * 64; // Conservative estimate of 64 bytes per tile entity
|
||||
|
||||
// Allocate output buffer
|
||||
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(size);
|
||||
|
@ -129,7 +129,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
|
|||
|
||||
// Encode tile entities into buffer
|
||||
NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(new ByteBufOutputStream(byteBuf));
|
||||
for (NbtMap blockEntity : chunkData.getBlockEntities()) {
|
||||
for (NbtMap blockEntity : chunkData.blockEntities()) {
|
||||
nbtStream.writeTag(blockEntity);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ import io.netty.buffer.ByteBuf;
|
|||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.entity.ItemFrameEntity;
|
||||
|
@ -470,9 +469,6 @@ public class ChunkUtils {
|
|||
session.getWorldBorder().setWorldCoordinateScale(coordinateScale);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class ChunkData {
|
||||
private final ChunkSection[] sections;
|
||||
private final NbtMap[] blockEntities;
|
||||
public record ChunkData(ChunkSection[] sections, NbtMap[] blockEntities) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue