2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2024-02-13 21:52:00 +00:00
|
|
|
From: Video <videogamesm12@gmail.com>
|
2023-12-11 00:23:09 +00:00
|
|
|
Date: Sun, 10 Dec 2023 17:39:52 -0600
|
2022-07-28 03:57:50 +00:00
|
|
|
Subject: [PATCH] Don't query player data in the `nbt` component
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
2024-04-16 03:24:44 +00:00
|
|
|
index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557c6b99e25 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
|
|
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
2023-12-11 00:23:09 +00:00
|
|
|
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
2023-07-01 20:21:13 +00:00
|
|
|
import java.util.List;
|
2023-12-11 00:23:09 +00:00
|
|
|
import java.util.stream.Stream;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
+
|
|
|
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
|
|
import net.minecraft.advancements.critereon.NbtPredicate;
|
|
|
|
import net.minecraft.commands.CommandSourceStack;
|
|
|
|
import net.minecraft.commands.arguments.selector.EntitySelector;
|
2022-07-28 03:57:50 +00:00
|
|
|
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
|
|
|
import net.minecraft.nbt.CompoundTag;
|
|
|
|
import net.minecraft.world.entity.Entity;
|
2023-12-11 00:23:09 +00:00
|
|
|
+import net.minecraft.world.entity.player.Player;
|
2022-07-28 03:57:50 +00:00
|
|
|
|
|
|
|
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
2024-04-16 03:24:44 +00:00
|
|
|
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec(
|
2023-12-11 00:23:09 +00:00
|
|
|
@@ -39,7 +42,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
2022-07-28 03:57:50 +00:00
|
|
|
public 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);
|
2023-12-11 00:23:09 +00:00
|
|
|
+ // Scissors start
|
2023-07-01 20:21:13 +00:00
|
|
|
+ Stream<? extends Entity> stream = list.stream();
|
|
|
|
+ if (ScissorsConfig.excludePlayersFromNbtComponents) stream = stream.filter((entity) -> !(entity instanceof Player));
|
|
|
|
+ return stream.map(NbtPredicate::getEntityTagToCompare);
|
2023-12-11 00:23:09 +00:00
|
|
|
+ // Scissors end
|
2022-07-28 03:57:50 +00:00
|
|
|
} else {
|
|
|
|
return Stream.empty();
|
|
|
|
}
|