BlockItemId .java

net.minecraft.references.BlockItemId (record, 23 lines): record with 2 components. members: block, item, create. imports: Item.

net.minecraft.referencesrecord23 linescommon876 B

API Surface (4)

record BlockItemId(ResourceKey<Block> block, ResourceKey<Item> item)
BlockItemId create(final Identifier blockId, final Identifier itemId)
BlockItemId create(final String blockName, final String itemName)
BlockItemId create(final String name)

Code Graph: Dependencies (5)

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

Full Source

BlockItemId.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.references;
2
3
import net.minecraft.core.registries.Registries;
4
import net.minecraft.resources.Identifier;
5
import net.minecraft.resources.ResourceKey;
6
import net.minecraft.world.item.Item;
7
import net.minecraft.world.level.block.Block;
8
9
public record BlockItemId(ResourceKey<Block> block, ResourceKey<Item> item) {
10
	public static BlockItemId create(final Identifier blockId, final Identifier itemId) {
11
		return new BlockItemId(ResourceKey.create(Registries.BLOCK, blockId), ResourceKey.create(Registries.ITEM, itemId));
12
	}
13
14
	public static BlockItemId create(final String blockName, final String itemName) {
15
		return create(Identifier.withDefaultNamespace(blockName), Identifier.withDefaultNamespace(itemName));
16
	}
17
18
	public static BlockItemId create(final String name) {
19
		Identifier id = Identifier.withDefaultNamespace(name);
20
		return create(id, id);
21
	}
22
}
23

Decompiled Minecraft 26.3 source of BlockItemId (net/minecraft/references/BlockItemId.java) with Mojang official mappings, stored verbatim on the site.