Class CropRegistration
java.lang.Object
ke.ric.api.registration.CropRegistration
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/..."));
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating crop definitions. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new crop definition builder.booleanisRegistered(String id) Check if a crop ID is already registered.booleanregister(CropRegistration.CropDefinitionBuilder definition) Register a custom crop definition.voidregisterAll(CropRegistration.CropDefinitionBuilder... definitions) Register multiple crops at once.intregisterFromFile(File cropFile, String defaultAddonId) Register addon crop definitions from an editable JSON file.booleanregisterPlantType(PlantType plantType) Register a custom plant type.booleanregisterPlantType(PlantType plantType, String addonId) Registers a plant type with the same owner cleanup and rollback as addon crops.intunregisterAddon(String addonId) Unregister all crop definitions owned by an addon.
-
Method Details
-
register
Register a custom crop definition.- Parameters:
definition- The crop definition to register- Returns:
- true if registered successfully
-
registerAll
Register multiple crops at once. -
registerFromFile
-
unregisterAddon
Unregister all crop definitions owned by an addon. -
registerPlantType
Register a custom plant type. Plant types define behavior like wall-climbing, spreading, etc. -
registerPlantType
-
isRegistered
Check if a crop ID is already registered. -
builder
Create a new crop definition builder.
-