24 lines
		
	
	
	
		
			843 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			843 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.world.item.crafting;
 | |
| 
 | |
| import net.minecraft.core.registries.Registries;
 | |
| import net.minecraft.network.RegistryFriendlyByteBuf;
 | |
| import net.minecraft.network.codec.StreamCodec;
 | |
| import net.minecraft.resources.ResourceKey;
 | |
| 
 | |
| public record RecipeHolder<T extends Recipe<?>>(ResourceKey<Recipe<?>> id, T value) {
 | |
| 	public static final StreamCodec<RegistryFriendlyByteBuf, RecipeHolder<?>> STREAM_CODEC = StreamCodec.composite(
 | |
| 		ResourceKey.streamCodec(Registries.RECIPE), RecipeHolder::id, Recipe.STREAM_CODEC, RecipeHolder::value, RecipeHolder::new
 | |
| 	);
 | |
| 
 | |
| 	public boolean equals(Object object) {
 | |
| 		return this == object ? true : object instanceof RecipeHolder<?> recipeHolder && this.id == recipeHolder.id;
 | |
| 	}
 | |
| 
 | |
| 	public int hashCode() {
 | |
| 		return this.id.hashCode();
 | |
| 	}
 | |
| 
 | |
| 	public String toString() {
 | |
| 		return this.id.toString();
 | |
| 	}
 | |
| }
 |