Interface CropGenerator
- All Known Implementing Classes:
MissingCropGenerator
public interface CropGenerator
Crop generators are used to find potential crops and generate data pack files for them. Generators are not meant to
be perfect, they are only meant to save as much time as possible when writing data pack files.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanGenerateCrop(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Determines if te generator can generate a crop 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 crop.
-
Method Details
-
canGenerateCrop
boolean canGenerateCrop(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Determines if te generator can generate a crop 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 a chance to generate a crop for the item.- 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 crop for the provided item.
-
generateData
com.google.gson.JsonObject generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack) Generates the JSON data for the crop.- 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 crop. The produced data must be a valid JSON representation that can be parsed by a registered recipe serializer.
-