2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Sat, 12 Nov 2016 23:25:22 -0600
|
|
|
|
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-06-06 02:17:27 +02:00
|
|
|
index 45712eb3967d61541580db57e1e9f84e6f5b9762..0b5e223594ff95b8ba7c300d4a66ca7a17e53802 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-06-06 02:17:27 +02:00
|
|
|
@@ -357,4 +357,12 @@ public class PaperWorldConfig {
|
2022-03-11 21:13:46 +01:00
|
|
|
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
|
|
|
|
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean filterNBTFromSpawnEgg = true;
|
|
|
|
+ private void fitlerNBTFromSpawnEgg() {
|
|
|
|
+ filterNBTFromSpawnEgg = getBoolean("filter-nbt-data-from-spawn-eggs-and-related", true);
|
|
|
|
+ if (!filterNBTFromSpawnEgg) {
|
|
|
|
+ Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
2022-04-30 18:27:41 +02:00
|
|
|
index 242e02646b8584a8d2a512374ad03729661d584f..08defb76e73a5f9121bf405c86a3c4c750ab1933 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
2022-04-30 18:27:41 +02:00
|
|
|
@@ -316,6 +316,18 @@ public class FallingBlockEntity extends Entity {
|
2021-06-11 14:02:28 +02:00
|
|
|
@Override
|
2021-06-12 08:24:50 +02:00
|
|
|
protected void readAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState"));
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start - Block FallingBlocks with Command Blocks
|
|
|
|
+ final Block b = this.blockState.getBlock();
|
2021-06-12 08:24:50 +02:00
|
|
|
+ if (this.level.paperConfig.filterNBTFromSpawnEgg
|
|
|
|
+ && (b == Blocks.COMMAND_BLOCK
|
|
|
|
+ || b == Blocks.REPEATING_COMMAND_BLOCK
|
|
|
|
+ || b == Blocks.CHAIN_COMMAND_BLOCK
|
|
|
|
+ || b == Blocks.JIGSAW
|
|
|
|
+ || b == Blocks.STRUCTURE_BLOCK
|
|
|
|
+ || b instanceof net.minecraft.world.level.block.GameMasterBlock)) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ this.blockState = Blocks.STONE.defaultBlockState();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2021-06-12 08:24:50 +02:00
|
|
|
this.time = nbt.getInt("Time");
|
|
|
|
if (nbt.contains("HurtEntities", 99)) {
|
|
|
|
this.hurtEntities = nbt.getBoolean("HurtEntities");
|