Class BlockSelection
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Contains all the information for a players block selection event
public class BlockSelection
- Inheritance
-
BlockSelection
- Inherited Members
- Extension Methods
Constructors
BlockSelection()
public BlockSelection()
BlockSelection(BlockPos, BlockFacing, Block)
Creates a basic BlockSelection from limited data
public BlockSelection(BlockPos pos, BlockFacing face, Block block)
Parameters
pos
BlockPosface
BlockFacingblock
Block
Fields
Block
The block actually being looked at!
public Block Block
Field Value
DidOffset
Always false during block use. True during placement if the Position value was offseted. Example:
- When trying to place planks while aiming at rock, the Position is the one in front of the Rock and DidOffset is True
- When trying to place planks while aiming at tallgrass, the Position is where the tall grass is and DidOffset is false (because tallgrass is replacable)
public bool DidOffset
Field Value
Face
The face the player aimed at
public BlockFacing Face
Field Value
HitPosition
The coordinate of the exact aimed position, relative to the Block Position
public Vec3d HitPosition
Field Value
Position
The position the player wants to place/break something at
public BlockPos Position
Field Value
SelectionBoxIndex
Which selection box was aimed at. The index corresponds to the array returned by Block.GetSelectionBoxes()
public int SelectionBoxIndex
Field Value
Properties
FullPosition
public Vec3d FullPosition { get; }
Property Value
Methods
AddPosCopy(int, int, int)
public BlockSelection AddPosCopy(int x, int y, int z)
Parameters
Returns
AddPosCopy(Vec3i)
public BlockSelection AddPosCopy(Vec3i vec)
Parameters
vec
Vec3i
Returns
Clone()
Creates a deep copy
public BlockSelection Clone()
Returns
GetDecorIndex(BlockFacing)
Turn face to a decor index
public static int GetDecorIndex(BlockFacing face)
Parameters
face
BlockFacing
Returns
GetDecorIndex(BlockFacing, int, int, int)
Turn face and local voxel position to a decor index
public static int GetDecorIndex(BlockFacing face, int vx, int vy, int vz)
Parameters
face
BlockFacingvx
int0..15
vy
int0..15
vz
int0..15
Returns
SetPos(int, int, int)
public BlockSelection SetPos(int x, int y, int z)
Parameters
Returns
ToDecorIndex()
Returns a subposition index for use addressing decor subpositions on a block
public int ToDecorIndex()