Class BasicSoil
java.lang.Object
net.darkhax.botanypots.common.api.data.recipes.BotanyPotRecipe
net.darkhax.botanypots.common.api.data.recipes.soil.Soil
net.darkhax.botanypots.common.impl.data.recipe.soil.BasicSoil
- All Implemented Interfaces:
CacheableRecipe,net.minecraft.world.item.crafting.Recipe<BotanyPotContext>
- Direct Known Subclasses:
BlockDerivedSoil
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<BasicSoil> static final net.minecraft.world.item.crafting.RecipeSerializer<BasicSoil> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, BasicSoil> Fields inherited from class net.darkhax.botanypots.common.api.data.recipes.soil.Soil
CACHE, RECIPES, TYPE, TYPE_IDFields inherited from interface net.minecraft.world.item.crafting.Recipe
STREAM_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if recipe can be cached based on the deserialized contents of the recipe.booleancouldMatch(net.minecraft.world.item.ItemStack candidate, BotanyPotContext context, net.minecraft.world.level.Level level) Tests if the recipe is valid for the current context.getDisplay(BotanyPotContext context, @NotNull net.minecraft.world.level.Level level) Gets the display for the soil.floatgetGrowthModifier(@NotNull BotanyPotContext context, @NotNull net.minecraft.world.level.Level level) Gets the modifier to apply to the crop growth rate.intgetLightLevel(@NotNull BotanyPotContext context, @NotNull net.minecraft.world.level.Level level) Gets the light level emitted by the soil.@NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> floatgetYieldModifier(BotanyPotContext context, net.minecraft.world.level.Level level) Gets a modifier that will be added to the chance that a crop will drop items when harvested.voidhoverTooltip(net.minecraft.world.item.ItemStack stack, BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.network.chat.Component> tooltipLines) Populates a tooltip when the item is hovered in a botany pot.booleanisCacheKey(net.minecraft.world.item.ItemStack stack) Determines if a given item would be a valid cache key for this recipe.booleanmatches(@NotNull BotanyPotContext input, @NotNull net.minecraft.world.level.Level level) Methods inherited from class net.darkhax.botanypots.common.api.data.recipes.soil.Soil
getSoil, getType, onTickMethods inherited from class net.darkhax.botanypots.common.api.data.recipes.BotanyPotRecipe
assemble, canCraftInDimensions, getResultItem, isSpecial, recipeCodec, recipeStream, showNotificationMethods 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
-
Field Details
-
CODEC
-
STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,BasicSoil> STREAM -
SERIALIZER
-
-
Constructor Details
-
BasicSoil
-
-
Method Details
-
getProperties
-
matches
public boolean matches(@NotNull @NotNull BotanyPotContext input, @NotNull @NotNull net.minecraft.world.level.Level level) - Specified by:
matchesin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
canBeCached
public boolean canBeCached()Description copied from interface:CacheableRecipeDetermines if recipe can be cached based on the deserialized contents of the recipe. For example, imagine a recipe with an optional list of non-cacheable conditions. If this list is not present or empty, the recipe could be cached when it otherwise could not.- Specified by:
canBeCachedin interfaceCacheableRecipe- Returns:
- If the recipe can be cached.
-
isCacheKey
public boolean isCacheKey(net.minecraft.world.item.ItemStack stack) Description copied from interface:CacheableRecipeDetermines if a given item would be a valid cache key for this recipe. Recipes can have more than one valid key.Implementations should only check intrinsic properties of the stack like the item id, tags, and the type of the item. Properties like data components should not be checked as these are not intrinsic to the item. An ItemStack is only provided in this context because it is needed to test Ingredient.
- Specified by:
isCacheKeyin interfaceCacheableRecipe- Parameters:
stack- The item to test.- Returns:
- If the item is a valid cache key for this recipe.
-
getGrowthModifier
public float getGrowthModifier(@NotNull @NotNull BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level) Description copied from class:SoilGets the modifier to apply to the crop growth rate.- Specified by:
getGrowthModifierin classSoil- Parameters:
context- The current context.level- The current game level.- Returns:
- The growth modifier of the soil.
-
getLightLevel
public int getLightLevel(@NotNull @NotNull BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level) Description copied from class:SoilGets the light level emitted by the soil.- Specified by:
getLightLevelin classSoil- Parameters:
context- The current context.level- The current game level.- Returns:
- The light level emitted by the soil.
-
getDisplay
public Display getDisplay(BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level) Description copied from class:SoilGets the display for the soil.- Specified by:
getDisplayin classSoil- Parameters:
context- The current context.level- The current game level.- Returns:
- The display for the soil.
-
getSerializer
@NotNull public @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()- Specified by:
getSerializerin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
hoverTooltip
public void hoverTooltip(net.minecraft.world.item.ItemStack stack, BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.network.chat.Component> tooltipLines) Description copied from class:BotanyPotRecipePopulates a tooltip when the item is hovered in a botany pot.- Overrides:
hoverTooltipin classBotanyPotRecipe- Parameters:
stack- The ItemStack being hovered.context- The context of the current situation.level- The current game level.tooltipLines- The list of tooltips being displayed.
-
couldMatch
public boolean couldMatch(net.minecraft.world.item.ItemStack candidate, BotanyPotContext context, net.minecraft.world.level.Level level) Description copied from class:BotanyPotRecipeTests if the recipe is valid for the current context.- Specified by:
couldMatchin classBotanyPotRecipe- Parameters:
candidate- The item to test.context- The current context.level- The current game level.- Returns:
- If the recipe is valid.
-
getYieldModifier
Description copied from class:SoilGets a modifier that will be added to the chance that a crop will drop items when harvested. If the chance exceeds 100% additional rolls can happen.- Overrides:
getYieldModifierin classSoil- Parameters:
context- The context of the crop being grown.level- The game level this is happening in.- Returns:
- The drop chance modifier to add to the base chance.
-