Class CropRegistration

java.lang.Object
ke.ric.api.registration.CropRegistration

public class CropRegistration extends Object
API for registering custom crops programmatically. Usage:
api.crops().register(CropRegistration.builder()
        .id("RENOIT")
        .itemId("RENOIT_GRAPE")
        .plantType("SHORT_PLANT")
        .growthDuration(600) // 10 minutes
        .growthStages(4)
        .validPlantingBlocks(Material.FARMLAND, Material.GRASS_BLOCK)
        .harvestDrop("RENOIT_GRAPE", 1, 3)
        .texture("http://textures.minecraft.net/...", "http://textures.minecraft.net/..."));
  • Method Details

    • register

      public boolean register(CropRegistration.CropDefinitionBuilder definition)
      Register a custom crop definition.
      Parameters:
      definition - The crop definition to register
      Returns:
      true if registered successfully
    • registerAll

      public void registerAll(CropRegistration.CropDefinitionBuilder... definitions)
      Register multiple crops at once.
    • registerFromFile

      public int registerFromFile(File cropFile, String defaultAddonId)
      Register addon crop definitions from an editable JSON file.
    • unregisterAddon

      public int unregisterAddon(String addonId)
      Unregister all crop definitions owned by an addon.
    • registerPlantType

      public boolean registerPlantType(PlantType plantType)
      Register a custom plant type. Plant types define behavior like wall-climbing, spreading, etc.
    • registerPlantType

      public boolean registerPlantType(PlantType plantType, String addonId)
      Registers a plant type with the same owner cleanup and rollback as addon crops.
    • isRegistered

      public boolean isRegistered(String id)
      Check if a crop ID is already registered.
    • builder

      public static CropRegistration.CropDefinitionBuilder builder()
      Create a new crop definition builder.