Class CropBehavior
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public abstract class CropBehavior
- Inheritance
-
CropBehavior
- Inherited Members
- Extension Methods
Constructors
CropBehavior(Block)
public CropBehavior(Block block)
Parameters
blockBlock
Fields
block
public Block block
Field Value
Methods
Initialize(JsonObject)
Initializes the crop with additional properties.
public virtual void Initialize(JsonObject properties)
Parameters
propertiesJsonObject
OnPlanted(ICoreAPI, ItemSlot, EntityAgent, BlockSelection)
The event fired when the crop is planted.
public virtual void OnPlanted(ICoreAPI api, ItemSlot itemslot, EntityAgent byEntity, BlockSelection blockSel)
Parameters
apiICoreAPIThe core API.
itemslotItemSlotThe itemslot that the plant was planted with.
byEntityEntityAgentThe entity that planted the plant.
blockSelBlockSelectionThe block selection used when the seed was planted.
TryGrowCrop(ICoreAPI, IFarmlandBlockEntity, double, int, ref EnumHandling)
Attempts to grow the crop.
public virtual bool TryGrowCrop(ICoreAPI api, IFarmlandBlockEntity farmland, double currentTotalHours, int newGrowthStage, ref EnumHandling handling)
Parameters
apiICoreAPIThe Core API
farmlandIFarmlandBlockEntityThe farmland below the crop.
currentTotalHoursdoublenewGrowthStageintThe next growth stage.
handlingEnumHandlingWhether or not this event was handled.
Returns
- bool
Whether or not the crop grew.