Multi Block Change API Implementation

This commit is contained in:
Brody Beckwith
2022-01-14 00:41:11 -05:00
parent 1476dea76f
commit a17ed327b3
2 changed files with 41 additions and 0 deletions

View File

@@ -21,3 +21,18 @@
private ClientboundSectionBlocksUpdatePacket(FriendlyByteBuf buf) {
this.sectionPos = SectionPos.of(buf.readLong());
int i = buf.readVarInt();
@@ -54,6 +62,14 @@
}
+ // Paper start - Multi Block Change API
+ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges) {
+ this.sectionPos = sectionPos;
+ this.positions = blockChanges.keySet().toShortArray();
+ this.states = blockChanges.values().toArray(new BlockState[0]);
+ }
+ // Paper end - Multi Block Change API
+
private void write(FriendlyByteBuf buf) {
buf.writeLong(this.sectionPos.asLong());
buf.writeVarInt(this.positions.length);