/* * Decompiled with CFR 0.152. */ package net.minecraft.world.item.crafting; import net.minecraft.core.NonNullList; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingBookCategory; import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeBookCategories; import net.minecraft.world.item.crafting.RecipeBookCategory; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; public interface CraftingRecipe extends Recipe { @Override default public RecipeType getType() { return RecipeType.CRAFTING; } @Override public RecipeSerializer getSerializer(); public CraftingBookCategory category(); default public NonNullList getRemainingItems(CraftingInput input) { return CraftingRecipe.defaultCraftingReminder(input); } public static NonNullList defaultCraftingReminder(CraftingInput input) { NonNullList result = NonNullList.withSize(input.size(), ItemStack.EMPTY); for (int slot = 0; slot < result.size(); ++slot) { Item item = input.getItem(slot).getItem(); result.set(slot, item.getCraftingRemainder()); } return result; } @Override default public RecipeBookCategory recipeBookCategory() { return switch (this.category()) { default -> throw new MatchException(null, null); case CraftingBookCategory.BUILDING -> RecipeBookCategories.CRAFTING_BUILDING_BLOCKS; case CraftingBookCategory.EQUIPMENT -> RecipeBookCategories.CRAFTING_EQUIPMENT; case CraftingBookCategory.REDSTONE -> RecipeBookCategories.CRAFTING_REDSTONE; case CraftingBookCategory.MISC -> RecipeBookCategories.CRAFTING_MISC; }; } }