Class Soil
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
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>
- Direct Known Subclasses:
BasicSoil
public abstract class Soil
extends net.darkhax.bookshelf.api.data.recipes.RecipeBaseData<net.minecraft.world.Container>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleancanGrowCrop(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.abstract DisplayStategetDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets the display state for the soil.abstract floatgetGrowthModifier(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.abstract intgetLightLevel(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.RecipeType<?>getType()abstract booleanmatchesLookup(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.voidonGrowthTick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop) A hook that is invoked when a crop is grown in the soil using a botany pot.voidonTick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) A hook that is invoked when a botany pot using the soil is ticked.Methods inherited from class net.darkhax.bookshelf.api.data.recipes.RecipeBaseData
assemble, canCraftInDimensions, getResultItem, matchesMethods inherited from class net.darkhax.bookshelf.api.data.recipes.RecipeBase
getIdMethods 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, getIngredients, getRemainingItems, getSerializer, getToastSymbol, isIncomplete, isSpecial, showNotification
-
Constructor Details
-
Soil
public Soil(net.minecraft.resources.ResourceLocation id)
-
-
Method Details
-
matchesLookup
public abstract 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. This is used when looking up soils from their ItemStack and determines which soil they represent.- 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 abstract float getGrowthModifier(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, @Nullable Crop crop) 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.
- 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 abstract 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.- 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 abstract 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.- 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 abstract Set<String> getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets a set of soil categories associated with the 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 abstract DisplayState getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets the display state for the soil. This will be used to render the soil in the pot.- 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.
-
onTick
public void onTick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) A hook that is invoked when a botany pot using the soil is ticked. This is invoked every tick, regardless of if a crop is being grown.- 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.
-
onGrowthTick
public void onGrowthTick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop) A hook that is invoked when a crop is grown in the soil using a botany pot.- 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.
-
getType
public net.minecraft.world.item.crafting.RecipeType<?> getType()
-