RecipePropertySet .java

net.minecraft.world.item.crafting.RecipePropertySet (class): members: BLAST_FURNACE_INPUT, SMITHING_ADDITION, SMITHING_TEMPLATE, BREWING_REAGENTS, items.

net.minecraft.world.item.craftingclass53 linescommon2.6 KB

API Surface (2)

boolean test(final ItemStack itemStack)
RecipePropertySet create(final Collection<Ingredient> ingredients)

Fields & Constants (13)

TYPE_KEY
SMITHING_BASE
SMITHING_TEMPLATE
SMITHING_ADDITION
FURNACE_INPUT
BLAST_FURNACE_INPUT
SMOKER_INPUT
CAMPFIRE_INPUT
BREWING_INPUTS
BREWING_REAGENTS
STREAM_CODEC
EMPTY
items

String literals (9)

"smithing_base"
"smithing_template"
"smithing_addition"
"furnace_input"
"blast_furnace_input"
"smoker_input"
"campfire_input"
"brewing_input"
"brewing_reagent"

Full Source

RecipePropertySet.java53 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item.crafting;
2
3
import java.util.Collection;
4
import java.util.List;
5
import java.util.Set;
6
import java.util.stream.Collectors;
7
import net.minecraft.core.Holder;
8
import net.minecraft.core.Registry;
9
import net.minecraft.network.RegistryFriendlyByteBuf;
10
import net.minecraft.network.codec.ByteBufCodecs;
11
import net.minecraft.network.codec.StreamCodec;
12
import net.minecraft.resources.Identifier;
13
import net.minecraft.resources.ResourceKey;
14
import net.minecraft.world.item.Item;
15
import net.minecraft.world.item.ItemStack;
16
17
public class RecipePropertySet {
18
	public static final ResourceKey<? extends Registry<RecipePropertySet>> TYPE_KEY = ResourceKey.createRegistryKey(
19
		Identifier.withDefaultNamespace("recipe_property_set")
20
	);
21
	public static final ResourceKey<RecipePropertySet> SMITHING_BASE = registerVanilla("smithing_base");
22
	public static final ResourceKey<RecipePropertySet> SMITHING_TEMPLATE = registerVanilla("smithing_template");
23
	public static final ResourceKey<RecipePropertySet> SMITHING_ADDITION = registerVanilla("smithing_addition");
24
	public static final ResourceKey<RecipePropertySet> FURNACE_INPUT = registerVanilla("furnace_input");
25
	public static final ResourceKey<RecipePropertySet> BLAST_FURNACE_INPUT = registerVanilla("blast_furnace_input");
26
	public static final ResourceKey<RecipePropertySet> SMOKER_INPUT = registerVanilla("smoker_input");
27
	public static final ResourceKey<RecipePropertySet> CAMPFIRE_INPUT = registerVanilla("campfire_input");
28
	public static final ResourceKey<RecipePropertySet> BREWING_INPUTS = registerVanilla("brewing_input");
29
	public static final ResourceKey<RecipePropertySet> BREWING_REAGENTS = registerVanilla("brewing_reagent");
30
	public static final StreamCodec<RegistryFriendlyByteBuf, RecipePropertySet> STREAM_CODEC = Item.STREAM_CODEC
31
		.apply(ByteBufCodecs.list())
32
		.map(holders -> new RecipePropertySet(Set.copyOf(holders)), propertySet -> List.copyOf(propertySet.items));
33
	public static final RecipePropertySet EMPTY = new RecipePropertySet(Set.of());
34
	private final Set<Holder<Item>> items;
35
36
	private RecipePropertySet(final Set<Holder<Item>> items) {
37
		this.items = items;
38
	}
39
40
	private static ResourceKey<RecipePropertySet> registerVanilla(final String name) {
41
		return ResourceKey.create(TYPE_KEY, Identifier.withDefaultNamespace(name));
42
	}
43
44
	public boolean test(final ItemStack itemStack) {
45
		return this.items.contains(itemStack.typeHolder());
46
	}
47
48
	public static RecipePropertySet create(final Collection<Ingredient> ingredients) {
49
		Set<Holder<Item>> items = ingredients.stream().flatMap(Ingredient::items).collect(Collectors.toUnmodifiableSet());
50
		return new RecipePropertySet(items);
51
	}
52
}
53

Decompiled Minecraft 26.3 source of RecipePropertySet (net/minecraft/world/item/crafting/RecipePropertySet.java) with Mojang official mappings, stored verbatim on the site.