Class MissingSoilGenerator
java.lang.Object
net.darkhax.botanypots.common.impl.command.generator.MissingSoilGenerator
- All Implemented Interfaces:
SoilGenerator
This soil generator is used as a fallback when none of the other generators have claimed an item. It looks for items
that are accepted by existing crops, or items that are part of a pot interaction recipe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanGenerateSoil(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Determines if the generator can generate a soil for a specific item.com.google.gson.JsonObjectgenerateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Generates the JSON data for the soil.
-
Constructor Details
-
MissingSoilGenerator
public MissingSoilGenerator()
-
-
Method Details
-
canGenerateSoil
public boolean canGenerateSoil(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Description copied from interface:SoilGeneratorDetermines if the generator can generate a soil for a specific item. If a generator returns true the item will be considered claimed by the generator and other generators will not be given the chance to generate a soil for the item.- Specified by:
canGenerateSoilin interfaceSoilGenerator- Parameters:
level- The current world level. Used to provide context like registry access and the recipe manager.stack- The item to test.- Returns:
- If the generator can generate a soil for the provided item.
-
generateData
public com.google.gson.JsonObject generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Description copied from interface:SoilGeneratorGenerates the JSON data for the soil.- Specified by:
generateDatain interfaceSoilGenerator- Parameters:
level- The current world level. Used to provide context like registry access and the recipe manager.stack- The item to test.- Returns:
- The JSON representation of the soil. The produced data must be a valid JSON representation that can be parsed by a registered recipe serializer.
-