AnyOfRuleTest .java

net.minecraft.world.level.levelgen.structure.templatesystem.AnyOfRuleTest (class, 33 lines): members: rules, test, getType, CODEC. strings: "rules".

net.minecraft.world.level.levelgen.structure.templatesystemclass33 linescommonextends RuleTest894 B

API Surface (2)

boolean test(final BlockState blockState, final BlockPos pos, final RandomSource random)
RuleTestType<?> getType()

Fields & Constants (2)

CODEC
rules

String literals (1)

"rules"

Code Graph: Dependencies (5)

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

Full Source

AnyOfRuleTest.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.structure.templatesystem;
2
3
import com.mojang.serialization.MapCodec;
4
import java.util.List;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.level.block.state.BlockState;
8
9
public class AnyOfRuleTest extends RuleTest {
10
	public static final MapCodec<AnyOfRuleTest> CODEC = RuleTest.CODEC.listOf().fieldOf("rules").xmap(AnyOfRuleTest::new, t -> t.rules);
11
	private final List<RuleTest> rules;
12
13
	public AnyOfRuleTest(final List<RuleTest> rules) {
14
		this.rules = rules;
15
	}
16
17
	@Override
18
	public boolean test(final BlockState blockState, final BlockPos pos, final RandomSource random) {
19
		for (RuleTest rule : this.rules) {
20
			if (rule.test(blockState, pos, random)) {
21
				return true;
22
			}
23
		}
24
25
		return false;
26
	}
27
28
	@Override
29
	protected RuleTestType<?> getType() {
30
		return RuleTestType.ANY_OF_TEST;
31
	}
32
}
33

Decompiled Minecraft 26.3 source of AnyOfRuleTest (net/minecraft/world/level/levelgen/structure/templatesystem/AnyOfRuleTest.java) with Mojang official mappings, stored verbatim on the site.