Implements EntitySubPredicate
API Surface (2) CubeMobPredicate sized(final MinMaxBounds.Ints size)
boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position)
Code Graph: Dependencies (6) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
CubeMobPredicate.java 26 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.advancements.predicates.entity;
2
3 import com.mojang.serialization.Codec;
4 import com.mojang.serialization.codecs.RecordCodecBuilder;
5 import net.minecraft.advancements.predicates.MinMaxBounds;
6 import net.minecraft.server.level.ServerLevel;
7 import net.minecraft.world.entity.Entity;
8 import net.minecraft.world.entity.monster.cubemob.AbstractCubeMob;
9 import net.minecraft.world.phys.Vec3;
10 import org.jspecify.annotations.Nullable;
11
12 public record CubeMobPredicate(MinMaxBounds.Ints size) implements EntitySubPredicate {
13 public static final Codec<CubeMobPredicate> CODEC = RecordCodecBuilder.create(
14 i -> i.group(MinMaxBounds.Ints.CODEC.optionalFieldOf("size", MinMaxBounds.Ints.ANY).forGetter(CubeMobPredicate::size)).apply(i, CubeMobPredicate::new)
15 );
16
17 public static CubeMobPredicate sized(final MinMaxBounds.Ints size) {
18 return new CubeMobPredicate(size);
19 }
20
21 @Override
22 public boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position) {
23 return entity instanceof AbstractCubeMob cubeMob ? this.size.matches(cubeMob.getSize()) : false;
24 }
25 }
26
Decompiled Minecraft 26.3 source of CubeMobPredicate (net/minecraft/advancements/predicates/entity/CubeMobPredicate.java) with Mojang official mappings, stored verbatim on the site.