Class BasicCrop
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.crop.Crop
net.darkhax.botanypots.data.recipes.crop.BasicCrop
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<DisplayState>The BlockState to render for the crop.protected intThe amount of ticks for the crop to grow under normal conditions.protected intThe light level of the soil when placed in the crop.protected List<HarvestEntry>An array of things the crop can drop.protected net.minecraft.world.item.crafting.IngredientThe ingredient used for the crop's seed.An array of valid soil categories. -
Constructor Summary
ConstructorsConstructorDescriptionBasicCrop(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.Ingredient seed, Set<String> soilCategories, int growthTicks, List<HarvestEntry> results, List<DisplayState> displayStates, int lightLevel) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanGrowInSoil(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil) Determines if the crop can grow in a given soil.List<net.minecraft.world.item.ItemStack>generateDrops(Random rng, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Generates a new list of drops to spawn when the crop has been harvested.getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets a set of soil categories the crop can grow in.getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets the display state of the crop.intintgetGrowthTicks(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil) Gets the amount of growth ticks required to grow the crop.intintgetLightLevel(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Gets the light level emitted by the crop when placed in a pot.net.minecraft.world.item.crafting.IngredientgetSeed()net.minecraft.world.item.crafting.RecipeSerializer<?>booleanmatchesLookup(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack placedStack) Tests if the crop matches the provided placement context.Methods inherited from class net.darkhax.botanypots.data.recipes.crop.Crop
getType, onGrowthTick, onTickMethods 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, getToastSymbol, isIncomplete, isSpecial, showNotification
-
Field Details
-
seed
protected net.minecraft.world.item.crafting.Ingredient seedThe ingredient used for the crop's seed. -
soilCategories
An array of valid soil categories. -
growthTicks
protected int growthTicksThe amount of ticks for the crop to grow under normal conditions. -
results
An array of things the crop can drop. -
displayStates
The BlockState to render for the crop. -
lightLevel
protected int lightLevelThe light level of the soil when placed in the crop. If this is not specified the light level of the first block indisplayStateswill be used.
-
-
Constructor Details
-
BasicCrop
public BasicCrop(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.Ingredient seed, Set<String> soilCategories, int growthTicks, List<HarvestEntry> results, List<DisplayState> displayStates, 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:CropTests if the crop matches the provided placement context. This is used when looking up crops from their ItemStack and determines which soil they represent.- Specified by:
matchesLookupin classCrop- Parameters:
level- The current world level that the crop is in.pos- The position of the pot.pot- The pot being used.placedStack- The ItemStack being placed.- Returns:
- Whether the crop matches the lookup context or not.
-
getGrowthTicks
public int getGrowthTicks(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, @Nullable Soil soil) Description copied from class:CropGets the amount of growth ticks required to grow the crop.The soil parameter may be null in some circumstances. This indicates that the soil is not available in the current context, such as generating tooltip information.
This code is not responsible for applying the growth modifier of the soil. This is handled externally. Implementations of this method should not factor this in themselves.
- Specified by:
getGrowthTicksin classCrop- Parameters:
level- The current world level that the crop is in.pos- The position that the pot is at.pot- The pot growing the crop.soil- The soil that the crop is growing in.- Returns:
- The amount of growth ticks required to grow the crop.
-
getLightLevel
public int getLightLevel(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Description copied from class:CropGets the light level emitted by the crop when placed in a pot.- Specified by:
getLightLevelin classCrop- Parameters:
level- The current world level that the crop is in.pos- The position that the pot is at.pot- The pot growing the crop.- Returns:
- The light level for the crop within the pot. This should be a value between 0 and 15.
-
canGrowInSoil
public boolean canGrowInSoil(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil) Description copied from class:CropDetermines if the crop can grow in a given soil.- Specified by:
canGrowInSoilin classCrop- Parameters:
level- The current world level that the crop is in.pos- The position of the pot.pot- The pot growing the crop.soil- The soil the crop is being grown in.- Returns:
- Whether the crop can grow in the soil.
-
getCategories
public Set<String> getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Description copied from class:CropGets a set of soil categories the crop can grow in.- Specified by:
getCategoriesin classCrop- Parameters:
level- The current world level that the crop is in.pos- The position of the pot.pot- The pot growing the crop.- Returns:
- A set of soil categories that the crop can grow in.
-
getDisplayState
public List<DisplayState> getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Description copied from class:CropGets the display state of the crop. This will be used to render the crop in the pot.- Specified by:
getDisplayStatein classCrop- Parameters:
level- The current world level that the pot is in.pos- The position that the pot is at.pot- The pot growing the crop.- Returns:
- A display state to render inside the pot.
-
generateDrops
public List<net.minecraft.world.item.ItemStack> generateDrops(Random rng, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot) Description copied from class:CropGenerates a new list of drops to spawn when the crop has been harvested.- Specified by:
generateDropsin classCroplevel- The current world level that the pot is in.pos- The position of the pot.pot- The pot growing the crop.- Returns:
- A list of drops to spawn when the crop is harvested.
-
getSerializer
public net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer() -
getSeed
public net.minecraft.world.item.crafting.Ingredient getSeed() -
getSoilCategories
-
getGrowthTicks
public int getGrowthTicks() -
getResults
-
getDisplayStates
-
getLightLevel
public int getLightLevel()
-