From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 15 Sep 2021 14:52:42 -0700
Subject: [PATCH] config for disabling entity tag tags


diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index c0062c8f83641ff30e79a309c0bb9930ba4b422a..5fb3279342506611882b5780cfbee0371919c93c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -502,6 +502,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
 
         if (minecraftserver != null && entity != null) {
             if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) {
+                    // Paper start - filter out protected tags
+                    if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) {
+                        nbt = nbt.update((compound) -> {
+                            for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) {
+                                tag.remove(compound);
+                            }
+                        });
+                    }
+                    // Paper end - filter out protected tags
+
                 nbt.loadInto(entity);
             }
         }
