Skip to content

Commit a720e79

Browse files
authored
chunkX, Y, Z is a block position (#333)
1 parent 885c702 commit a720e79

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v465/serializer/UpdateSubChunkBlocksSerializer_v465.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ public class UpdateSubChunkBlocksSerializer_v465 implements BedrockPacketSeriali
1717

1818
@Override
1919
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, UpdateSubChunkBlocksPacket packet) {
20-
VarInts.writeInt(buffer, packet.getChunkX());
21-
VarInts.writeUnsignedInt(buffer, packet.getChunkY());
22-
VarInts.writeInt(buffer, packet.getChunkZ());
20+
helper.writeBlockPosition(buffer, packet.getPosition());
2321
helper.writeArray(buffer, packet.getStandardBlocks(), this::writeBlockChangeEntry);
2422
helper.writeArray(buffer, packet.getExtraBlocks(), this::writeBlockChangeEntry);
2523
}
2624

2725
@Override
2826
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, UpdateSubChunkBlocksPacket packet) {
29-
packet.setChunkX(VarInts.readInt(buffer));
30-
packet.setChunkY(VarInts.readUnsignedInt(buffer));
31-
packet.setChunkZ(VarInts.readInt(buffer));
27+
packet.setPosition(helper.readBlockPosition(buffer));
3228
helper.readArray(buffer, packet.getStandardBlocks(), this::readBlockChangeEntry);
3329
helper.readArray(buffer, packet.getExtraBlocks(), this::readBlockChangeEntry);
3430
}

bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/UpdateSubChunkBlocksPacket.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import lombok.Data;
55
import lombok.EqualsAndHashCode;
66
import lombok.ToString;
7+
import org.cloudburstmc.math.vector.Vector3i;
78
import org.cloudburstmc.protocol.bedrock.data.BlockChangeEntry;
89
import org.cloudburstmc.protocol.common.PacketSignal;
910

@@ -13,9 +14,7 @@
1314
@EqualsAndHashCode(doNotUseGetters = true)
1415
@ToString(doNotUseGetters = true)
1516
public class UpdateSubChunkBlocksPacket implements BedrockPacket {
16-
private int chunkX;
17-
private int chunkY;
18-
private int chunkZ;
17+
private Vector3i position;
1918

2019
private final List<BlockChangeEntry> standardBlocks = new ObjectArrayList<>();
2120
private final List<BlockChangeEntry> extraBlocks = new ObjectArrayList<>();

0 commit comments

Comments
 (0)