Sanitize sent BlockEntity NBT
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
private void validateBlockState(BlockState state) {
|
||||
@@ -74,8 +85,17 @@
|
||||
@@ -74,7 +85,16 @@
|
||||
return this.level != null;
|
||||
}
|
||||
|
||||
@@ -35,17 +35,16 @@
|
||||
+ // CraftBukkit start - read container
|
||||
+ protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
+ this.persistentDataContainer.clear(); // Paper - clear instead of init
|
||||
|
||||
+
|
||||
+ net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
|
||||
+ if (persistentDataTag instanceof CompoundTag) {
|
||||
+ this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public final void loadWithComponents(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
this.loadAdditional(nbt, registries);
|
||||
BlockEntity.ComponentHelper.COMPONENTS_CODEC.parse(registries.createSerializationContext(NbtOps.INSTANCE), nbt).resultOrPartial((s) -> {
|
||||
@@ -114,6 +134,11 @@
|
||||
}).ifPresent((nbtbase) -> {
|
||||
nbttagcompound.merge((CompoundTag) nbtbase);
|
||||
@@ -109,7 +108,7 @@
|
||||
}
|
||||
|
||||
protected void collectImplicitComponents(DataComponentMap.Builder builder) {}
|
||||
@@ -321,6 +361,22 @@
|
||||
@@ -321,6 +361,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +127,14 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // Paper start - Sanitize sent data
|
||||
+ public CompoundTag sanitizeSentNbt(CompoundTag tag) {
|
||||
+ tag.remove("PublicBukkitValues");
|
||||
+
|
||||
+ return tag;
|
||||
+ }
|
||||
+ // Paper end - Sanitize sent data
|
||||
+
|
||||
private static class ComponentHelper {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user