Don't query NBT from players in the nbt text component

This commit is contained in:
Video 2022-04-09 13:02:56 -06:00
parent 3fca938ad8
commit ecfd11a180

View File

@ -0,0 +1,27 @@
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 f5f2ec1192303bc55a64dce3e0457e4531a35ba7..62613d9fccd74fe16512fe1fe703dc6db0166b28 100644
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
@@ -22,6 +22,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.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -218,7 +219,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();
}