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
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    CompostRecipe(@NotNull net.minecraft.world.item.crafting.Ingredient ingredient, int strength)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull net.minecraft.world.item.ItemStack
    assemble(@NotNull net.minecraft.world.item.crafting.SingleRecipeInput input, net.minecraft.core.HolderLookup.Provider provider)
     
    boolean
    canCraftInDimensions(int width, int height)
     
    int
    The 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.Ingredient
    Get the input ingredient for this recipe (this is multiple alternative item types).
    @NotNull net.minecraft.world.item.ItemStack
    getResultItem(net.minecraft.core.HolderLookup.Provider provider)
     
    @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?>
     
    int
    Get the strength of this recipe.
    @NotNull net.minecraft.world.item.crafting.RecipeType<?>
     
    static @NotNull CompostRecipe
    individualize(@NotNull net.minecraft.world.item.Item item, @NotNull net.minecraft.world.item.crafting.RecipeHolder<CompostRecipe> recipe)
     
    boolean
    matches(@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, wait

    Methods inherited from interface net.minecraft.world.item.crafting.Recipe

    getGroup, getRemainingItems, getToastSymbol, isIncomplete, isSpecial, showNotification
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<CompostRecipe> 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:
      getType in interface net.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). Use getIngredients() 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:
      matches in interface net.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:
      assemble in interface net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
    • canCraftInDimensions

      public boolean canCraftInDimensions(int width, int height)
      Specified by:
      canCraftInDimensions in interface net.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:
      getResultItem in interface net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.SingleRecipeInput>
    • getSerializer

      @NotNull public @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
      Specified by:
      getSerializer in interface net.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:
      getIngredients in interface net.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)