Paper/patches/server/0107-Filter-bad-data-from-A...

30 lines
1.6 KiB
Diff

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/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 6c4be7da19d0d61f35942558d438587853231aaa..18d81e8e8f387a7fb531652cb78c61a9bd5ae600 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -316,6 +316,18 @@ public class FallingBlockEntity extends Entity {
@Override
protected void readAdditionalSaveData(CompoundTag nbt) {
this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState"));
+ // Paper start - Block FallingBlocks with Command Blocks
+ final Block b = this.blockState.getBlock();
+ if (this.level.paperConfig().entities.spawning.filterNbtDataFromSpawnEggsAndRelated
+ && (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)) {
+ this.blockState = Blocks.STONE.defaultBlockState();
+ }
+ // Paper end
this.time = nbt.getInt("Time");
if (nbt.contains("HurtEntities", 99)) {
this.hurtEntities = nbt.getBoolean("HurtEntities");