PassengerPredicate .java

net.minecraft.advancements.predicates.entity.PassengerPredicate (record, 23 lines): members: passenger, matches, CODEC. imports: Entity.

net.minecraft.advancements.predicates.entityrecord23 linescommon771 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

PassengerPredicate.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.advancements.predicates.entity;
2
3
import com.mojang.serialization.Codec;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.world.entity.Entity;
6
import net.minecraft.world.phys.Vec3;
7
import org.jspecify.annotations.Nullable;
8
9
public record PassengerPredicate(EntityPredicate passenger) implements EntitySubPredicate {
10
	public static final Codec<PassengerPredicate> CODEC = EntityPredicate.CODEC.xmap(PassengerPredicate::new, PassengerPredicate::passenger);
11
12
	@Override
13
	public boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position) {
14
		for (Entity passenger : entity.getPassengers()) {
15
			if (this.passenger.matches(level, position, passenger)) {
16
				return true;
17
			}
18
		}
19
20
		return false;
21
	}
22
}
23

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