Class MissingCropGenerator

java.lang.Object
net.darkhax.botanypots.common.impl.command.generator.MissingCropGenerator
All Implemented Interfaces:
CropGenerator

public class MissingCropGenerator extends Object implements CropGenerator
This crop generator is used as a fallback when none of the other generators have claimed an item. It will generate a block derived crop for a wide range of blocks in the game such as flowers, seeds, crop blocks, bonemealable blocks, and corals.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    com.google.gson.JsonObject
    generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
    Generates the JSON data for the crop.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MissingCropGenerator

      public MissingCropGenerator()
  • Method Details

    • canGenerateCrop

      public boolean canGenerateCrop(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: CropGenerator
      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.
      Specified by:
      canGenerateCrop in interface CropGenerator
      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

      public com.google.gson.JsonObject generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: CropGenerator
      Generates the JSON data for the crop.
      Specified by:
      generateData in interface CropGenerator
      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.