Scissors/patches/server/0014-Don-t-query-player-data-in-the-nbt-component.patch

28 lines
1.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sat, 9 Apr 2022 13:00:27 -0600
Subject: [PATCH] Don't query player data in the `nbt` component
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
index 8e658eeb4edc83db72c187baa52b7ada7b848af8..e3dc56de3f91e03b1543257f72448a734d914ed7 100644
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
@@ -23,6 +23,7 @@ import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.slf4j.Logger;
@@ -217,7 +218,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
protected Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
if (this.compiledSelector != null) {
List<? extends Entity> list = this.compiledSelector.findEntities(source);
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
+ return list.stream().filter((entity) -> !(entity instanceof Player)).map(NbtPredicate::getEntityTagToCompare); // Scissors - Don't query NBT from players
} else {
return Stream.empty();
}