Class BlockEntityBehavior
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Basic class for block entities - a data structures to hold custom information for blocks, e.g. for chests to hold it's contents
public abstract class BlockEntityBehavior
- Inheritance
-
BlockEntityBehavior
- Inherited Members
- Extension Methods
Constructors
BlockEntityBehavior(BlockEntity)
public BlockEntityBehavior(BlockEntity blockentity)
Parameters
blockentity
BlockEntity
Fields
Api
public ICoreAPI Api
Field Value
Blockentity
The block for this behavior instance.
public BlockEntity Blockentity
Field Value
properties
The properties of this block behavior.
public JsonObject properties
Field Value
Properties
Block
Alias of BlockEntity.Block
public Block Block { get; }
Property Value
Pos
Alias of Blockentity.Pos
public BlockPos Pos { get; }
Property Value
Methods
FromTreeAttributes(ITreeAttribute, IWorldAccessor)
public virtual void FromTreeAttributes(ITreeAttribute tree, IWorldAccessor worldAccessForResolve)
Parameters
tree
ITreeAttributeworldAccessForResolve
IWorldAccessor
GetBlockInfo(IPlayer, StringBuilder)
public virtual void GetBlockInfo(IPlayer forPlayer, StringBuilder dsc)
Parameters
forPlayer
IPlayerdsc
StringBuilder
Initialize(ICoreAPI, JsonObject)
Called right after the block behavior was created
public virtual void Initialize(ICoreAPI api, JsonObject properties)
Parameters
api
ICoreAPIproperties
JsonObject
OnBlockBroken(IPlayer)
public virtual void OnBlockBroken(IPlayer byPlayer = null)
Parameters
byPlayer
IPlayer
OnBlockPlaced(ItemStack)
public virtual void OnBlockPlaced(ItemStack byItemStack = null)
Parameters
byItemStack
ItemStack
OnBlockRemoved()
public virtual void OnBlockRemoved()
OnBlockUnloaded()
public virtual void OnBlockUnloaded()
OnLoadCollectibleMappings(IWorldAccessor, Dictionary<int, AssetLocation>, Dictionary<int, AssetLocation>, int)
[Obsolete("Use the variant with resolveImports parameter")]
public virtual void OnLoadCollectibleMappings(IWorldAccessor worldForNewMappings, Dictionary<int, AssetLocation> oldBlockIdMapping, Dictionary<int, AssetLocation> oldItemIdMapping, int schematicSeed)
Parameters
worldForNewMappings
IWorldAccessoroldBlockIdMapping
Dictionary<int, AssetLocation>oldItemIdMapping
Dictionary<int, AssetLocation>schematicSeed
int
OnLoadCollectibleMappings(IWorldAccessor, Dictionary<int, AssetLocation>, Dictionary<int, AssetLocation>, int, bool)
public virtual void OnLoadCollectibleMappings(IWorldAccessor worldForNewMappings, Dictionary<int, AssetLocation> oldBlockIdMapping, Dictionary<int, AssetLocation> oldItemIdMapping, int schematicSeed, bool resolveImports)
Parameters
worldForNewMappings
IWorldAccessoroldBlockIdMapping
Dictionary<int, AssetLocation>oldItemIdMapping
Dictionary<int, AssetLocation>schematicSeed
intresolveImports
bool
OnPlacementBySchematic(ICoreServerAPI, IBlockAccessor, BlockPos, Dictionary<int, Dictionary<int, int>>, int, Block, bool)
public virtual void OnPlacementBySchematic(ICoreServerAPI api, IBlockAccessor blockAccessor, BlockPos pos, Dictionary<int, Dictionary<int, int>> replaceBlocks, int centerrockblockid, Block layerBlock, bool resolveImports)
Parameters
api
ICoreServerAPIblockAccessor
IBlockAccessorpos
BlockPosreplaceBlocks
Dictionary<int, Dictionary<int, int>>centerrockblockid
intlayerBlock
BlockresolveImports
bool
OnReceivedClientPacket(IPlayer, int, byte[])
public virtual void OnReceivedClientPacket(IPlayer fromPlayer, int packetid, byte[] data)
Parameters
OnReceivedServerPacket(int, byte[])
public virtual void OnReceivedServerPacket(int packetid, byte[] data)
Parameters
OnStoreCollectibleMappings(Dictionary<int, AssetLocation>, Dictionary<int, AssetLocation>)
public virtual void OnStoreCollectibleMappings(Dictionary<int, AssetLocation> blockIdMapping, Dictionary<int, AssetLocation> itemIdMapping)
Parameters
blockIdMapping
Dictionary<int, AssetLocation>itemIdMapping
Dictionary<int, AssetLocation>
OnTesselation(ITerrainMeshPool, ITesselatorAPI)
public virtual bool OnTesselation(ITerrainMeshPool mesher, ITesselatorAPI tessThreadTesselator)
Parameters
mesher
ITerrainMeshPooltessThreadTesselator
ITesselatorAPI
Returns
ToTreeAttributes(ITreeAttribute)
public virtual void ToTreeAttributes(ITreeAttribute tree)
Parameters
tree
ITreeAttribute