Class BasicSoil

java.lang.Object
net.darkhax.bookshelf.api.data.recipes.RecipeBase<C>
net.darkhax.bookshelf.api.data.recipes.RecipeBaseData<net.minecraft.world.Container>
net.darkhax.botanypots.data.recipes.soil.Soil
net.darkhax.botanypots.data.recipes.soil.BasicSoil
All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>

public class BasicSoil extends Soil
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Set<String>
    An array of associated soil categories.
    protected DisplayState
    The blockstate used to render the soil.
    protected float
    A modifier applied to the growth time of the crop.
    protected net.minecraft.world.item.crafting.Ingredient
    The item used to get the soil into the pot.
    protected int
    The light level for the soil when placed in a botany pot.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BasicSoil(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.Ingredient ingredient, DisplayState renderState, float growthModifier, Set<String> categories, int lightLevel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canGrowCrop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop)
    Determines if a given crop can grow in this soil.
     
    getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
    Gets a set of soil categories associated with the soil.
     
    getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
    Gets the display state for the soil.
    float
     
    float
    getGrowthModifier(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop)
    Gets the growth modifier applied by the soil when growing a crop.
    net.minecraft.world.item.crafting.Ingredient
     
    int
     
    int
    getLightLevel(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
    Gets the light level emitted by the soil when placed in a pot.
    net.minecraft.world.item.crafting.RecipeSerializer<?>
     
    net.minecraft.world.item.crafting.RecipeType<?>
     
    boolean
    matchesLookup(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack placedStack)
    Tests if the soil matches the provided placement context.

    Methods inherited from class net.darkhax.botanypots.data.recipes.soil.Soil

    onGrowthTick, onTick

    Methods inherited from class net.darkhax.bookshelf.api.data.recipes.RecipeBaseData

    assemble, canCraftInDimensions, getResultItem, matches

    Methods inherited from class net.darkhax.bookshelf.api.data.recipes.RecipeBase

    getId

    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, getIngredients, getRemainingItems, getToastSymbol, isIncomplete, isSpecial, showNotification
  • Field Details

    • ingredient

      protected net.minecraft.world.item.crafting.Ingredient ingredient
      The item used to get the soil into the pot.
    • displayState

      protected DisplayState displayState
      The blockstate used to render the soil.
    • growthModifier

      protected float growthModifier
      A modifier applied to the growth time of the crop.
    • categories

      protected Set<String> categories
      An array of associated soil categories.
    • lightLevel

      protected int lightLevel
      The light level for the soil when placed in a botany pot.
  • Constructor Details

    • BasicSoil

      public BasicSoil(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.Ingredient ingredient, DisplayState renderState, float growthModifier, Set<String> categories, int lightLevel)
  • Method Details

    • matchesLookup

      public boolean matchesLookup(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack placedStack)
      Description copied from class: Soil
      Tests if the soil matches the provided placement context. This is used when looking up soils from their ItemStack and determines which soil they represent.
      Specified by:
      matchesLookup in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position of the pot.
      pot - The pot being used.
      placedStack - The ItemStack being placed.
      Returns:
      Whether the soil matches the lookup context or not.
    • getGrowthModifier

      public float getGrowthModifier(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, @Nullable Crop crop)
      Description copied from class: Soil
      Gets the growth modifier applied by the soil when growing a crop. The growth modifier will be multiplied by the crops total growth time to create the required growth time. For example a growth modifier of 0.5f would make a crop that normally takes 1200 ticks to grow take just 600 ticks. A modifier of 2 would make the same crop take 2400 ticks. The base growth modifier value is 1f.

      The crop parameter may be null in some circumstances. This indicates that the crop is not available in the current context, such as generating tooltip information.

      Specified by:
      getGrowthModifier in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position that the soil is being used at.
      pot - The pot using the soil.
      crop - The crop being grown in the soil.
      Returns:
      The growth modifier applied to the crop growth time when planted in this soil.
    • getLightLevel

      public int getLightLevel(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Soil
      Gets the light level emitted by the soil when placed in a pot.
      Specified by:
      getLightLevel in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position that the soil is being used at.
      pot - The pot using the soil.
      Returns:
      The light level for the soil within the pot. This should be a value between 0 and 15.
    • canGrowCrop

      public boolean canGrowCrop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop)
      Description copied from class: Soil
      Determines if a given crop can grow in this soil.
      Specified by:
      canGrowCrop in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position that the soil is being used at.
      pot - The pot using the soil.
      crop - The crop being tested.
      Returns:
      Whether the crop can grow in the soil or not.
    • getCategories

      public Set<String> getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Soil
      Gets a set of soil categories associated with the soil.
      Specified by:
      getCategories in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position that the soil is being used at.
      pot - The pot using the soil.
      Returns:
      A set of soil categories associated with the soil.
    • getDisplayState

      public DisplayState getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Soil
      Gets the display state for the soil. This will be used to render the soil in the pot.
      Specified by:
      getDisplayState in class Soil
      Parameters:
      level - The current world level that the soil is in.
      pos - The position that the soil is being used at.
      pot - The pot using the soil.
      Returns:
      A display state to render inside the botany pot.
    • getType

      public net.minecraft.world.item.crafting.RecipeType<?> getType()
      Specified by:
      getType in interface net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>
      Overrides:
      getType in class Soil
    • getSerializer

      public net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
    • getIngredient

      public net.minecraft.world.item.crafting.Ingredient getIngredient()
    • getDisplayState

      public DisplayState getDisplayState()
    • getGrowthModifier

      public float getGrowthModifier()
    • getCategories

      public Set<String> getCategories()
    • getLightLevel

      public int getLightLevel()