Table of Contents

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

block Block

Fields

block

public Block block

Field Value

Block

Methods

Initialize(JsonObject)

Initializes the crop with additional properties.

public virtual void Initialize(JsonObject properties)

Parameters

properties JsonObject

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

api ICoreAPI

The core API.

itemslot ItemSlot

The itemslot that the plant was planted with.

byEntity EntityAgent

The entity that planted the plant.

blockSel BlockSelection

The 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

api ICoreAPI

The Core API

farmland IFarmlandBlockEntity

The farmland below the crop.

currentTotalHours double
newGrowthStage int

The next growth stage.

handling EnumHandling

Whether or not this event was handled.

Returns

bool

Whether or not the crop grew.