RecipeHolder .java

net.minecraft.world.item.crafting.RecipeHolder (record, 28 lines): members: value, hashCode, equals, STREAM_CODEC. imports: RegistryFriendlyByteBuf.

net.minecraft.world.item.craftingrecord28 linescommonextends Recipe<861 B

API Surface (3)

boolean equals(final Object obj)
int hashCode()
String toString()

Fields & Constants (1)

STREAM_CODEC

Code Graph: Dependencies (5)

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

Full Source

RecipeHolder.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item.crafting;
2
3
import net.minecraft.core.registries.Registries;
4
import net.minecraft.network.RegistryFriendlyByteBuf;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.resources.ResourceKey;
7
8
public record RecipeHolder<T extends Recipe<?>>(ResourceKey<Recipe<?>> id, T value) {
9
	public static final StreamCodec<RegistryFriendlyByteBuf, RecipeHolder<?>> STREAM_CODEC = StreamCodec.composite(
10
		ResourceKey.streamCodec(Registries.RECIPE), RecipeHolder::id, Recipe.STREAM_CODEC, RecipeHolder::value, RecipeHolder::new
11
	);
12
13
	@Override
14
	public boolean equals(final Object obj) {
15
		return this == obj ? true : obj instanceof RecipeHolder<?> holder && this.id == holder.id;
16
	}
17
18
	@Override
19
	public int hashCode() {
20
		return this.id.hashCode();
21
	}
22
23
	@Override
24
	public String toString() {
25
		return this.id.toString();
26
	}
27
}
28

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