mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Sanitize Sent BlockEntity NBT (#7010)
This commit is contained in:
parent
63ffb7fd84
commit
4810e202fe
1 changed files with 48 additions and 0 deletions
48
patches/server/Sanitize-Sent-BlockEntity-NBT.patch
Normal file
48
patches/server/Sanitize-Sent-BlockEntity-NBT.patch
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
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
|
||||||
|
Subject: [PATCH] Sanitize Sent BlockEntity NBT
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
||||||
|
BlockPos blockPos = blockEntity.getBlockPos();
|
||||||
|
if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
|
||||||
|
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
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class BlockEntity {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
+ // Paper start
|
||||||
|
+ public CompoundTag sanitizeSentNbt(CompoundTag tag) {
|
||||||
|
+ tag.remove("PublicBukkitValues");
|
||||||
|
+
|
||||||
|
+ return tag;
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
}
|
Loading…
Reference in a new issue