V4307 .java

net.minecraft.util.datafix.schemas.V4307 (class, 36 lines): members: components, registerTypes, entityTypes. strings: "minecraft:can_place_on", "blocks".

net.minecraft.util.datafix.schemasclass36 linescommonextends NamespacedSchema1.4 KB

API Surface (2)

SequencedMap<String, Supplier<TypeTemplate>> components(final Schema schema)
void registerTypes(final Schema schema, final Map<String, Supplier<TypeTemplate>> entityTypes, final Map<String, Supplier<TypeTemplate>> blockEntityTypes)

Fields & Constants (1)

entityTypes

String literals (3)

"minecraft:can_place_on"
"minecraft:can_break"
"blocks"

Code Graph: Dependencies (3)

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

Full Source

V4307.java36 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.schemas;
2
3
import com.mojang.datafixers.DSL;
4
import com.mojang.datafixers.schemas.Schema;
5
import com.mojang.datafixers.types.templates.TypeTemplate;
6
import java.util.Map;
7
import java.util.SequencedMap;
8
import java.util.function.Supplier;
9
import net.minecraft.util.datafix.fixes.References;
10
11
public class V4307 extends NamespacedSchema {
12
	public V4307(final int versionKey, final Schema parent) {
13
		super(versionKey, parent);
14
	}
15
16
	public static SequencedMap<String, Supplier<TypeTemplate>> components(final Schema schema) {
17
		SequencedMap<String, Supplier<TypeTemplate>> components = V4059.components(schema);
18
		components.put("minecraft:can_place_on", () -> adventureModePredicate(schema));
19
		components.put("minecraft:can_break", () -> adventureModePredicate(schema));
20
		return components;
21
	}
22
23
	private static TypeTemplate adventureModePredicate(final Schema schema) {
24
		TypeTemplate predicate = DSL.optionalFields("blocks", DSL.or(References.BLOCK_NAME.in(schema), DSL.list(References.BLOCK_NAME.in(schema))));
25
		return DSL.or(predicate, DSL.list(predicate));
26
	}
27
28
	@Override
29
	public void registerTypes(
30
		final Schema schema, final Map<String, Supplier<TypeTemplate>> entityTypes, final Map<String, Supplier<TypeTemplate>> blockEntityTypes
31
	) {
32
		super.registerTypes(schema, entityTypes, blockEntityTypes);
33
		schema.registerType(true, References.DATA_COMPONENTS, () -> DSL.optionalFieldsLazy(components(schema)));
34
	}
35
}
36

Decompiled Minecraft 26.3 source of V4307 (net/minecraft/util/datafix/schemas/V4307.java) with Mojang official mappings, stored verbatim on the site.