Class BlockLayersAccess
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Constants used for GetBlock or GetBlockId calls throughout the engine, to guide whether the block should be read from the solid blocks layer, the fluids layer, or perhaps both.
The game engine supports different block layers in 1.17+. Currently there is a solid blocks layer (e.g. terrain, loose stones, plants, reeds) and a fluid layer (e.g. still water, flowing water, lava, lake ice). Both layers can contain a block at the same position.
Use the .Default value for getting blocks in the general case, use the .Solid/.Fluid value to read from the solid blocks or fluid layer specifically
public class BlockLayersAccess
- Inheritance
-
BlockLayersAccess
- Inherited Members
- Extension Methods
Fields
Default
GetBlock:
Returns the contents of the solid blocks layer. If the solid blocks layer is completely empty, returns the value from the fluid layer instead. Keep in mind, the fluid layer might contain ice!
If this returns air (block id 0) then it really is an air block: there is nothing in either the solid blocks layer or the fluid layer
SetBlock:
Sets supplied block id. If that blocks property ForFluidsLayer is true, it will be placed in the fluids layer instead and the solid block layer will be cleared.
public const int Default = 0
Field Value
Fluid
Returns a block from the fluid layer only, which might contain ice.
A return value of air (block id 0) signifies no fluid is present at this position
public const int Fluid = 2
Field Value
FluidOrSolid
Returns the contents of the fluid layer, unless it is empty in which case returns the solid blocks layer - useful for generating the RainHeightMap for example
public const int FluidOrSolid = 3
Field Value
MostSolid
Returns the most solid block, in the following order:
- Ice in the fluid layer
- Whichever block is in the solid blocks layer
- Air (block id 0) if neither is present - note this access may therefore return 0 even if liquid water or lava is present in the fluid layer.
Useful for block collision checks, side solid checks (can a block attach here?) and similar physics
public const int MostSolid = 4
Field Value
Solid
Returns a block from the solid blocks layer only. Same as SolidBlocks
public const int Solid = 1
Field Value
SolidBlocks
Returns a block from the solid blocks layer only.
A return value of air (block id 0) signifies no solid block is present but there may still be a fluid block, for example still water
public const int SolidBlocks = 1