Class BlockSchematic
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
[JsonObject(MemberSerialization.OptIn)]
public class BlockSchematic
- Inheritance
-
BlockSchematic
- Inherited Members
- Extension Methods
Constructors
BlockSchematic()
public BlockSchematic()
BlockSchematic(IServerWorldAccessor, IBlockAccessor, BlockPos, BlockPos, bool)
public BlockSchematic(IServerWorldAccessor world, IBlockAccessor blockAccess, BlockPos start, BlockPos end, bool notLiquids)
Parameters
world
IServerWorldAccessorblockAccess
IBlockAccessorstart
BlockPosend
BlockPosnotLiquids
bool
BlockSchematic(IServerWorldAccessor, BlockPos, BlockPos, bool)
Construct a schematic from a specified area in the specified world
public BlockSchematic(IServerWorldAccessor world, BlockPos start, BlockPos end, bool notLiquids)
Parameters
world
IServerWorldAccessorstart
BlockPosend
BlockPosnotLiquids
bool
Fields
AbovegroundBlockId
public static int AbovegroundBlockId
Field Value
AbovegroundCheckPositions
public BlockPos[] AbovegroundCheckPositions
Field Value
- BlockPos[]
BlockCodes
[JsonProperty]
public Dictionary<int, AssetLocation> BlockCodes
Field Value
BlockEntities
[JsonProperty]
public Dictionary<uint, string> BlockEntities
Field Value
BlockEntitiesUnpacked
public Dictionary<BlockPos, string> BlockEntitiesUnpacked
Field Value
BlockIds
[JsonProperty]
public List<int> BlockIds
Field Value
BlocksUnpacked
public Dictionary<BlockPos, int> BlocksUnpacked
Field Value
DecorIds
[JsonProperty]
public List<long> DecorIds
Field Value
DecorIndices
[JsonProperty]
public List<uint> DecorIndices
Field Value
DecorsUnpacked
public Dictionary<BlockPos, Dictionary<int, Block>> DecorsUnpacked
Field Value
Entities
[JsonProperty]
public List<string> Entities
Field Value
EntitiesUnpacked
public List<Entity> EntitiesUnpacked
Field Value
EntranceRotation
[JsonProperty]
public int EntranceRotation
Field Value
FillerBlockId
public static int FillerBlockId
Field Value
FluidsLayerUnpacked
public Dictionary<BlockPos, int> FluidsLayerUnpacked
Field Value
GameVersion
[JsonProperty]
public string GameVersion
Field Value
Indices
[JsonProperty]
public List<uint> Indices
Field Value
ItemCodes
[JsonProperty]
public Dictionary<int, AssetLocation> ItemCodes
Field Value
OmitLiquids
public bool OmitLiquids
Field Value
OriginalPos
[JsonProperty]
public BlockPos OriginalPos
Field Value
PackedOffset
public FastVec3i PackedOffset
Field Value
PathwayBlockId
public static int PathwayBlockId
Field Value
PathwayBlocksUnpacked
public List<BlockPosFacing> PathwayBlocksUnpacked
Field Value
PathwayOffsets
Distance from the bottom left door block, so the bottom left door block is always at 0,0,0
public BlockPos[][] PathwayOffsets
Field Value
- BlockPos[][]
PathwaySides
public BlockFacing[] PathwaySides
Field Value
PathwayStarts
Distance positions from bottom left corner of the schematic. Only the first door block.
public BlockPos[] PathwayStarts
Field Value
- BlockPos[]
PosBitMask
This bitmask for the position in schematics
public const uint PosBitMask = 1023
Field Value
ReplaceMode
[JsonProperty]
public EnumReplaceMode ReplaceMode
Field Value
SizeX
[JsonProperty]
public int SizeX
Field Value
SizeY
[JsonProperty]
public int SizeY
Field Value
SizeZ
[JsonProperty]
public int SizeZ
Field Value
UndergroundBlockId
public static int UndergroundBlockId
Field Value
UndergroundCheckPositions
public BlockPos[] UndergroundCheckPositions
Field Value
- BlockPos[]
empty
protected ushort empty
Field Value
Properties
BlockRemaps
Set by the RemapperAssistant in OnFinalizeAssets
Heads up!: This is unordered, it will iterate through the different game versions' remaps not necessarily in the order they originally appear in remaps.json config. If any block remaps over the years have duplicate original block names, behavior for those ones may be unpredictable
public static Dictionary<string, Dictionary<string, string>> BlockRemaps { get; set; }
Property Value
ItemRemaps
Set by the RemapperAssistant in OnFinalizeAssets
public static Dictionary<string, Dictionary<string, string>> ItemRemaps { get; set; }
Property Value
Methods
AddArea(IWorldAccessor, IBlockAccessor, BlockPos, BlockPos)
public virtual void AddArea(IWorldAccessor world, IBlockAccessor blockAccess, BlockPos start, BlockPos end)
Parameters
world
IWorldAccessorblockAccess
IBlockAccessorstart
BlockPosend
BlockPos
AddArea(IWorldAccessor, BlockPos, BlockPos)
Adds an area to the schematic.
public virtual void AddArea(IWorldAccessor world, BlockPos start, BlockPos end)
Parameters
world
IWorldAccessorThe world the blocks are in
start
BlockPosThe start position of all the blocks.
end
BlockPosThe end position of all the blocks.
AdjustStartPos(BlockPos, EnumOrigin)
Adjusts the starting position of the schemtic.
public virtual BlockPos AdjustStartPos(BlockPos startpos, EnumOrigin origin)
Parameters
startpos
BlockPosorigin
EnumOrigin
Returns
ClonePacked()
Makes a deep copy of the packed schematic. Unpacked data and loaded meta information is not cloned.
public virtual BlockSchematic ClonePacked()
Returns
DecodeBlockEntityData(string)
Imports the tree data from a string.
public virtual TreeAttribute DecodeBlockEntityData(string data)
Parameters
data
string
Returns
EncodeBlockEntityData(BlockEntity)
Exports the block entity data to a string.
public virtual string EncodeBlockEntityData(BlockEntity be)
Parameters
be
BlockEntity
Returns
GetJustPositions(BlockPos)
Gets just the positions of the blocks.
public virtual BlockPos[] GetJustPositions(BlockPos origin)
Parameters
origin
BlockPosThe origin point to start from
Returns
- BlockPos[]
An array containing the BlockPos of each block in the area.
GetRotatedPos(EnumOrigin, int, int, int, int)
public BlockPos GetRotatedPos(EnumOrigin aroundOrigin, int angle, int dx, int dy, int dz)
Parameters
aroundOrigin
EnumOriginangle
intdx
intdy
intdz
int
Returns
GetStartPos(BlockPos, EnumOrigin)
Gets the starting position of the schematic.
public virtual BlockPos GetStartPos(BlockPos pos, EnumOrigin origin)
Parameters
pos
BlockPosorigin
EnumOrigin
Returns
Init(IBlockAccessor)
public virtual void Init(IBlockAccessor blockAccessor)
Parameters
blockAccessor
IBlockAccessor
IsFillerOrPath(Block)
public bool IsFillerOrPath(Block newBlock)
Parameters
newBlock
Block
Returns
LoadFromFile(string, ref string)
Loads the schematic from a file.
public static BlockSchematic LoadFromFile(string infilepath, ref string error)
Parameters
Returns
LoadFromString(string, ref string)
Loads a schematic from a string.
public static BlockSchematic LoadFromString(string jsoncode, ref string error)
Parameters
Returns
LoadMetaInformationAndValidate(IBlockAccessor, IWorldAccessor, string)
Loads the meta information for each block in the schematic.
public void LoadMetaInformationAndValidate(IBlockAccessor blockAccessor, IWorldAccessor worldForResolve, string fileNameForLogging)
Parameters
blockAccessor
IBlockAccessorworldForResolve
IWorldAccessorfileNameForLogging
string
Pack(IWorldAccessor, BlockPos)
public virtual bool Pack(IWorldAccessor world, BlockPos startPos)
Parameters
world
IWorldAccessorstartPos
BlockPos
Returns
PasteToMiniDimension(ICoreServerAPI, IBlockAccessor, IMiniDimension, BlockPos, bool)
public void PasteToMiniDimension(ICoreServerAPI sapi, IBlockAccessor blockAccess, IMiniDimension miniDimension, BlockPos originPos, bool replaceMetaBlocks)
Parameters
sapi
ICoreServerAPIblockAccess
IBlockAccessorminiDimension
IMiniDimensionoriginPos
BlockPosreplaceMetaBlocks
bool
Place(IBlockAccessor, IWorldAccessor, BlockPos, bool)
Will place all blocks using the configured replace mode. Note: If you use a revertable or bulk block accessor you will have to call PlaceBlockEntities() after the Commit()
public virtual int Place(IBlockAccessor blockAccessor, IWorldAccessor worldForCollectibleResolve, BlockPos startPos, bool replaceMetaBlocks = true)
Parameters
blockAccessor
IBlockAccessorworldForCollectibleResolve
IWorldAccessorstartPos
BlockPosreplaceMetaBlocks
bool
Returns
Place(IBlockAccessor, IWorldAccessor, BlockPos, EnumReplaceMode, bool)
Will place all blocks using the supplied replace mode. Note: If you use a revertable or bulk block accessor you will have to call PlaceBlockEntities() after the Commit()
public virtual int Place(IBlockAccessor blockAccessor, IWorldAccessor worldForCollectibleResolve, BlockPos startPos, EnumReplaceMode mode, bool replaceMetaBlocks = true)
Parameters
blockAccessor
IBlockAccessorworldForCollectibleResolve
IWorldAccessorstartPos
BlockPosmode
EnumReplaceModereplaceMetaBlocks
bool
Returns
PlaceDecors(IBlockAccessor, BlockPos)
public virtual void PlaceDecors(IBlockAccessor blockAccessor, BlockPos startPos)
Parameters
blockAccessor
IBlockAccessorstartPos
BlockPos
PlaceDecors(IBlockAccessor, BlockPos, Rectanglei)
public virtual void PlaceDecors(IBlockAccessor blockAccessor, BlockPos startPos, Rectanglei rect)
Parameters
blockAccessor
IBlockAccessorstartPos
BlockPosrect
Rectanglei
PlaceEntitiesAndBlockEntities(IBlockAccessor, IWorldAccessor, BlockPos, Dictionary<int, AssetLocation>, Dictionary<int, AssetLocation>, bool, Dictionary<int, Dictionary<int, int>>, int, Dictionary<BlockPos, Block>, bool)
Places all the entities and blocks in the schematic at the position.
public void PlaceEntitiesAndBlockEntities(IBlockAccessor blockAccessor, IWorldAccessor worldForCollectibleResolve, BlockPos startPos, Dictionary<int, AssetLocation> blockCodes, Dictionary<int, AssetLocation> itemCodes, bool replaceBlockEntities = false, Dictionary<int, Dictionary<int, int>> replaceBlocks = null, int centerrockblockid = 0, Dictionary<BlockPos, Block> layerBlockForBlockEntities = null, bool resolveImports = true)
Parameters
blockAccessor
IBlockAccessorworldForCollectibleResolve
IWorldAccessorstartPos
BlockPosblockCodes
Dictionary<int, AssetLocation>itemCodes
Dictionary<int, AssetLocation>replaceBlockEntities
boolreplaceBlocks
Dictionary<int, Dictionary<int, int>>centerrockblockid
intlayerBlockForBlockEntities
Dictionary<BlockPos, Block>resolveImports
boolTurn it off to spawn structures as they are. For example, in this mode, instead of traders, their meta spawners will spawn
PlaceReplaceAll(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceAll(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessor
IBlockAccessorpos
BlockPosnewBlock
BlockreplaceMeta
bool
Returns
PlaceReplaceAllNoAir(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceAllNoAir(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessor
IBlockAccessorpos
BlockPosnewBlock
BlockreplaceMeta
bool
Returns
PlaceReplaceOnlyAir(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceOnlyAir(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessor
IBlockAccessorpos
BlockPosnewBlock
BlockreplaceMeta
bool
Returns
PlaceReplaceable(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceable(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessor
IBlockAccessorpos
BlockPosnewBlock
BlockreplaceMeta
bool
Returns
Save(string)
Saves a schematic to a file.
public virtual string Save(string outfilepath)
Parameters
outfilepath
string
Returns
StringEncodeTreeAttribute(ITreeAttribute)
Exports the tree attribute data to a string.
public virtual string StringEncodeTreeAttribute(ITreeAttribute tree)
Parameters
tree
ITreeAttribute
Returns
ToJson()
public virtual string ToJson()
Returns
TransformWhilePacked(IWorldAccessor, EnumOrigin, int, EnumAxis?, bool)
Attempts to transform each block as they are placed in directions different from the schematic.
public virtual void TransformWhilePacked(IWorldAccessor worldForResolve, EnumOrigin aroundOrigin, int angle, EnumAxis? flipAxis = null, bool isDungeon = false)
Parameters
worldForResolve
IWorldAccessoraroundOrigin
EnumOriginangle
intflipAxis
EnumAxis?isDungeon
bool