# Developer > Developer API reference for ML Planting Category: PLANTING · Source: https://miciomods.it/docs/ml-planting-developer · Last updated: 2026-07-28 ## Overview ML Planting exposes server and client exports for querying plant data, plus server-side handler hooks in `server/handlers.lua` (shipped unescrowed) for plant lifecycle events. ## Server Exports ```lua local plantType = exports.ml_planting:GetPlantTypeConfig(typeId) local allTypes = exports.ml_planting:GetAllPlantTypes() local categories = exports.ml_planting:GetCategories() local category = exports.ml_planting:GetCategoryConfig(categoryId) ``` - `GetPlantTypeConfig(typeId)`: Returns the plant type definition table - `GetAllPlantTypes()`: Returns all plant type definitions - `GetCategories()`: Returns all categories - `GetCategoryConfig(categoryId)`: Returns a specific category config ## Client Exports ```lua local zoneId = exports.ml_planting:IsInGrowZone(coords) local plants = exports.ml_planting:GetNearbyPlants(distance) local entity = exports.ml_planting:GetPlantEntity(plantId) ``` - `IsInGrowZone(coords)`: Returns the zone id if the coordinates are inside a growth zone, `nil` otherwise - `GetNearbyPlants(distance)`: Returns the streamed plants within the given distance of the player - `GetPlantEntity(plantId)`: Returns the local prop entity handle of a streamed plant ## Server Event Handlers Located in `server/handlers.lua`. Override to hook into plant lifecycle events. **server/handlers.lua** ```lua function Handlers.OnPlantCreated(source, plantData) end function Handlers.OnPlantWatered(source, plant, item, amount) end function Handlers.OnPlantFertilized(source, plant, item, amount) end function Handlers.OnPlantHarvested(source, plant, rewards) end function Handlers.OnPlantDestroyed(source, plant) end function Handlers.CanPlant(source, seed, coords) return true -- return false to block end function Handlers.CanHarvest(source, plant) return true -- return false to block end function Handlers.ModifyHarvestRewards(source, plant, rewards) return rewards -- modify and return end ``` **Log Harvests to an External System** **server/handlers.lua** ```lua function Handlers.OnPlantHarvested(source, plant, rewards) exports['my_logging']:LogAction(source, 'harvested', plant.seed) end ``` **Block Harvest for Certain Jobs** **server/handlers.lua** ```lua function Handlers.CanHarvest(source, plant) local job = Bridge.GetJob(source) if job and job.name == 'police' then return false end return true end ```