Package com.minecolonies.api.crafting
Class CompostRecipe
java.lang.Object
com.minecolonies.api.crafting.CompostRecipe
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
public class CompostRecipe
extends Object
implements net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
A vanilla recipe class describing the operation of the compost barrel. Primarily this is just used to
assign different "strength" ratings to different input items; currently the actual outputs of the barrel
are fixed.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<CompostRecipe> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, CompostRecipe> Fields inherited from interface net.minecraft.world.item.crafting.Recipe
CONDITIONAL_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionCompostRecipe(@NotNull net.minecraft.world.item.crafting.Ingredient ingredient, int strength) -
Method Summary
Modifier and TypeMethodDescription@NotNull net.minecraft.world.item.ItemStackassemble(@NotNull net.minecraft.world.item.crafting.SingleRecipeInput input, net.minecraft.core.HolderLookup.Provider provider) booleancanCraftInDimensions(int width, int height) intThe number of ticks that this recipe should take to ferment into compost.@NotNull net.minecraft.core.NonNullList<net.minecraft.world.item.crafting.Ingredient> Gets the list of ingredients for this recipe; there will only be one, but it is a multi-alternative stack and includes the specific count of items that are required.net.minecraft.world.item.crafting.IngredientgetInput()Get the input ingredient for this recipe (this is multiple alternative item types).@NotNull net.minecraft.world.item.ItemStackgetResultItem(net.minecraft.core.HolderLookup.Provider provider) @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> intGet the strength of this recipe.@NotNull net.minecraft.world.item.crafting.RecipeType<?> getType()static @NotNull CompostRecipeindividualize(@NotNull net.minecraft.world.item.Item item, @NotNull net.minecraft.world.item.crafting.RecipeHolder<CompostRecipe> recipe) booleanmatches(@NotNull net.minecraft.world.item.crafting.SingleRecipeInput input, @NotNull net.minecraft.world.level.Level worldIn) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.item.crafting.Recipe
getGroup, getRemainingItems, getToastSymbol, isIncomplete, isSpecial, showNotification
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,CompostRecipe> STREAM_CODEC
-
-
Constructor Details
-
CompostRecipe
public CompostRecipe(@NotNull @NotNull net.minecraft.world.item.crafting.Ingredient ingredient, int strength)
-
-
Method Details
-
getType
@NotNull public @NotNull net.minecraft.world.item.crafting.RecipeType<?> getType()- Specified by:
getTypein interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
getInput
public net.minecraft.world.item.crafting.Ingredient getInput()Get the input ingredient for this recipe (this is multiple alternative item types). UsegetIngredients()instead to also calculate the amount of items needed for one composting operation.- Returns:
- The input.
-
getStrength
public int getStrength()Get the strength of this recipe. A higher strength means fewer input items are required to craft the same quantity of output compost/dirt.- Returns:
- The strength; typically 2, 4, or 8, but other values are possible.
-
getFermentTime
public int getFermentTime()The number of ticks that this recipe should take to ferment into compost. This is currently just for informational purposes and is not configurable (nor actually used).- Returns:
- A number of ticks.
-
matches
public boolean matches(@NotNull @NotNull net.minecraft.world.item.crafting.SingleRecipeInput input, @NotNull @NotNull net.minecraft.world.level.Level worldIn) - Specified by:
matchesin interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
assemble
@NotNull public @NotNull net.minecraft.world.item.ItemStack assemble(@NotNull @NotNull net.minecraft.world.item.crafting.SingleRecipeInput input, @NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
assemblein interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
canCraftInDimensions
public boolean canCraftInDimensions(int width, int height) - Specified by:
canCraftInDimensionsin interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
getResultItem
@NotNull public @NotNull net.minecraft.world.item.ItemStack getResultItem(@Nullable net.minecraft.core.HolderLookup.Provider provider) - Specified by:
getResultItemin interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
getSerializer
@NotNull public @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()- Specified by:
getSerializerin interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
-
getIngredients
@NotNull public @NotNull net.minecraft.core.NonNullList<net.minecraft.world.item.crafting.Ingredient> getIngredients()Gets the list of ingredients for this recipe; there will only be one, but it is a multi-alternative stack and includes the specific count of items that are required.- Specified by:
getIngredientsin interfacenet.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>- Returns:
- The list of input ingredients.
-
individualize
@NotNull public static @NotNull CompostRecipe individualize(@NotNull @NotNull net.minecraft.world.item.Item item, @NotNull @NotNull net.minecraft.world.item.crafting.RecipeHolder<CompostRecipe> recipe)
-