2022-06-02 03:27:36 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 3 Dec 2021 16:55:50 -0500
2024-01-18 18:52:00 +01:00
Subject: [PATCH] Sanitize sent BlockEntity NBT
2022-06-02 03:27:36 +02:00
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
2023-09-22 19:59:56 +02:00
index d79284a790569141c2ac8178d6ecc20b17cdd0d3..3944852921335c78a04a9dc301882ab5b152b1ed 100644
2022-06-02 03:27:36 +02:00
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
@@ -17,7 +17,7 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
private final CompoundTag tag;
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity, Function<BlockEntity, CompoundTag> nbtGetter) {
- return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), nbtGetter.apply(blockEntity));
+ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(nbtGetter.apply(blockEntity))); // Paper - Sanitize sent data
}
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) {
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
2024-01-23 18:01:39 +01:00
index f47eeb70661661610ef1a96dd9da67785825c126..89e3163b0301f8414c9400a6e00cdd85841fe2e8 100644
2022-06-02 03:27:36 +02:00
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
2024-01-23 18:01:39 +01:00
@@ -152,6 +152,7 @@ public class ClientboundLevelChunkPacketData {
2022-06-09 23:27:06 +02:00
CompoundTag compoundTag = blockEntity.getUpdateTag();
2022-06-02 03:27:36 +02:00
BlockPos blockPos = blockEntity.getBlockPos();
int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ());
+ blockEntity.sanitizeSentNbt(compoundTag); // Paper - Sanitize sent data
return new ClientboundLevelChunkPacketData.BlockEntityInfo(i, blockPos.getY(), blockEntity.getType(), compoundTag.isEmpty() ? null : compoundTag);
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
2024-01-24 15:57:53 +01:00
index 4893eaf93738da860014ddf3ad003334c9ebc9fa..20201430ee8f28245aa845acb172d0f5d80458ff 100644
2022-06-02 03:27:36 +02:00
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
2024-01-18 18:52:00 +01:00
@@ -253,4 +253,11 @@ public abstract class BlockEntity {
2022-06-02 03:27:36 +02:00
return null;
}
// CraftBukkit end
2024-01-18 18:52:00 +01:00
+ // Paper start - Sanitize sent data
2022-06-02 03:27:36 +02:00
+ public CompoundTag sanitizeSentNbt(CompoundTag tag) {
+ tag.remove("PublicBukkitValues");
+
+ return tag;
+ }
2024-01-18 18:52:00 +01:00
+ // Paper end - Sanitize sent data
2022-06-02 03:27:36 +02:00
}