PeriodicEntityTickPredicate .java

net.minecraft.advancements.predicates.entity.PeriodicEntityTickPredicate (record, 19 lines): members: periodicTick, matches, CODEC. imports: ExtraCodecs.

net.minecraft.advancements.predicates.entityrecord19 linescommon742 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

PeriodicEntityTickPredicate.java19 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.util.ExtraCodecs;
6
import net.minecraft.world.entity.Entity;
7
import net.minecraft.world.phys.Vec3;
8
import org.jspecify.annotations.Nullable;
9
10
public record PeriodicEntityTickPredicate(int periodicTick) implements EntitySubPredicate {
11
	public static final Codec<PeriodicEntityTickPredicate> CODEC = ExtraCodecs.POSITIVE_INT
12
		.xmap(PeriodicEntityTickPredicate::new, PeriodicEntityTickPredicate::periodicTick);
13
14
	@Override
15
	public boolean matches(final Entity entity, final ServerLevel level, final @Nullable Vec3 position) {
16
		return entity.tickCount % this.periodicTick == 0;
17
	}
18
}
19

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