EntityPartialComponentsPredicate .java

net.minecraft.advancements.predicates.entity.EntityPartialComponentsPredicate (record): members: predicates, matches, CODEC. imports: Entity, Vec3.

net.minecraft.advancements.predicates.entityrecord26 linescommon970 B

Implements

API Surface (1)

boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position)

Fields & Constants (1)

CODEC

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntityPartialComponentsPredicate.java26 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.advancements.predicates.entity;
2
3
import com.mojang.serialization.Codec;
4
import java.util.Map;
5
import net.minecraft.core.component.predicates.DataComponentPredicate;
6
import net.minecraft.server.level.ServerLevel;
7
import net.minecraft.world.entity.Entity;
8
import net.minecraft.world.phys.Vec3;
9
import org.jspecify.annotations.Nullable;
10
11
public record EntityPartialComponentsPredicate(Map<DataComponentPredicate.Type<?>, DataComponentPredicate> predicates) implements EntitySubPredicate {
12
	public static final Codec<EntityPartialComponentsPredicate> CODEC = DataComponentPredicate.CODEC
13
		.xmap(EntityPartialComponentsPredicate::new, EntityPartialComponentsPredicate::predicates);
14
15
	@Override
16
	public boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position) {
17
		for (DataComponentPredicate predicate : this.predicates.values()) {
18
			if (!predicate.matches(entity)) {
19
				return false;
20
			}
21
		}
22
23
		return true;
24
	}
25
}
26

Decompiled Minecraft 26.3 source of EntityPartialComponentsPredicate (net/minecraft/advancements/predicates/entity/EntityPartialComponentsPredicate.java) with Mojang official mappings, stored verbatim on the site.