V1458 .java

net.minecraft.util.datafix.schemas.V1458 (class): members: nameableInventory, nameable, registerTypes, registerBlockEntities, entityTypes. imports: DSL.

net.minecraft.util.datafix.schemasclass55 linescommonextends NamespacedSchema2.3 KB

API Surface (4)

void registerTypes(final Schema schema, final Map<String, Supplier<TypeTemplate>> entityTypes, final Map<String, Supplier<TypeTemplate>> blockEntityTypes)
Map<String, Supplier<TypeTemplate>> registerBlockEntities(final Schema schema)
TypeTemplate nameableInventory(final Schema schema)
TypeTemplate nameable(final Schema schema)

Fields & Constants (1)

entityTypes

String literals (13)

"CustomName"
"minecraft:beacon"
"minecraft:banner"
"minecraft:brewing_stand"
"minecraft:chest"
"minecraft:trapped_chest"
"minecraft:dispenser"
"minecraft:dropper"
"minecraft:enchanting_table"
"minecraft:furnace"
"minecraft:hopper"
"minecraft:shulker_box"
"Items"

Code Graph: Dependencies (2)

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

Full Source

V1458.java55 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.function.Supplier;
8
import net.minecraft.util.datafix.fixes.References;
9
10
public class V1458 extends NamespacedSchema {
11
	public V1458(final int versionKey, final Schema parent) {
12
		super(versionKey, parent);
13
	}
14
15
	@Override
16
	public void registerTypes(
17
		final Schema schema, final Map<String, Supplier<TypeTemplate>> entityTypes, final Map<String, Supplier<TypeTemplate>> blockEntityTypes
18
	) {
19
		super.registerTypes(schema, entityTypes, blockEntityTypes);
20
		schema.registerType(
21
			true,
22
			References.ENTITY,
23
			() -> DSL.and(
24
				References.ENTITY_EQUIPMENT.in(schema),
25
				DSL.optionalFields("CustomName", References.TEXT_COMPONENT.in(schema), DSL.taggedChoiceLazy("id", namespacedString(), entityTypes))
26
			)
27
		);
28
	}
29
30
	@Override
31
	public Map<String, Supplier<TypeTemplate>> registerBlockEntities(final Schema schema) {
32
		Map<String, Supplier<TypeTemplate>> map = super.registerBlockEntities(schema);
33
		schema.register(map, "minecraft:beacon", () -> nameable(schema));
34
		schema.register(map, "minecraft:banner", () -> nameable(schema));
35
		schema.register(map, "minecraft:brewing_stand", () -> nameableInventory(schema));
36
		schema.register(map, "minecraft:chest", () -> nameableInventory(schema));
37
		schema.register(map, "minecraft:trapped_chest", () -> nameableInventory(schema));
38
		schema.register(map, "minecraft:dispenser", () -> nameableInventory(schema));
39
		schema.register(map, "minecraft:dropper", () -> nameableInventory(schema));
40
		schema.register(map, "minecraft:enchanting_table", () -> nameable(schema));
41
		schema.register(map, "minecraft:furnace", () -> nameableInventory(schema));
42
		schema.register(map, "minecraft:hopper", () -> nameableInventory(schema));
43
		schema.register(map, "minecraft:shulker_box", () -> nameableInventory(schema));
44
		return map;
45
	}
46
47
	public static TypeTemplate nameableInventory(final Schema schema) {
48
		return DSL.optionalFields("Items", DSL.list(References.ITEM_STACK.in(schema)), "CustomName", References.TEXT_COMPONENT.in(schema));
49
	}
50
51
	public static TypeTemplate nameable(final Schema schema) {
52
		return DSL.optionalFields("CustomName", References.TEXT_COMPONENT.in(schema));
53
	}
54
}
55

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