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
worldIServerWorldAccessorblockAccessIBlockAccessorstartBlockPosendBlockPosnotLiquidsbool
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
worldIServerWorldAccessorstartBlockPosendBlockPosnotLiquidsbool
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
worldIWorldAccessorblockAccessIBlockAccessorstartBlockPosendBlockPos
AddArea(IWorldAccessor, BlockPos, BlockPos)
Adds an area to the schematic.
public virtual void AddArea(IWorldAccessor world, BlockPos start, BlockPos end)
Parameters
worldIWorldAccessorThe world the blocks are in
startBlockPosThe start position of all the blocks.
endBlockPosThe 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
startposBlockPosoriginEnumOrigin
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
datastring
Returns
EncodeBlockEntityData(BlockEntity)
Exports the block entity data to a string.
public virtual string EncodeBlockEntityData(BlockEntity be)
Parameters
beBlockEntity
Returns
EncodeBlockEntityData(BlockEntity, FastMemoryStream)
public virtual string EncodeBlockEntityData(BlockEntity be, FastMemoryStream ms)
Parameters
beBlockEntitymsFastMemoryStream
Returns
GetJustPositions(BlockPos)
Gets just the positions of the blocks.
public virtual BlockPos[] GetJustPositions(BlockPos origin)
Parameters
originBlockPosThe 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
aroundOriginEnumOriginangleintdxintdyintdzint
Returns
GetStartPos(BlockPos, EnumOrigin)
Gets the starting position of the schematic.
public virtual BlockPos GetStartPos(BlockPos pos, EnumOrigin origin)
Parameters
posBlockPosoriginEnumOrigin
Returns
Init(IBlockAccessor)
public virtual void Init(IBlockAccessor blockAccessor)
Parameters
blockAccessorIBlockAccessor
IsFillerOrPath(Block)
public bool IsFillerOrPath(Block newBlock)
Parameters
newBlockBlock
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
blockAccessorIBlockAccessorworldForResolveIWorldAccessorfileNameForLoggingstring
Pack(IWorldAccessor, BlockPos)
public virtual bool Pack(IWorldAccessor world, BlockPos startPos)
Parameters
worldIWorldAccessorstartPosBlockPos
Returns
PasteToMiniDimension(ICoreServerAPI, IBlockAccessor, IMiniDimension, BlockPos, bool)
public void PasteToMiniDimension(ICoreServerAPI sapi, IBlockAccessor blockAccess, IMiniDimension miniDimension, BlockPos originPos, bool replaceMetaBlocks)
Parameters
sapiICoreServerAPIblockAccessIBlockAccessorminiDimensionIMiniDimensionoriginPosBlockPosreplaceMetaBlocksbool
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
blockAccessorIBlockAccessorworldForCollectibleResolveIWorldAccessorstartPosBlockPosreplaceMetaBlocksbool
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
blockAccessorIBlockAccessorworldForCollectibleResolveIWorldAccessorstartPosBlockPosmodeEnumReplaceModereplaceMetaBlocksbool
Returns
PlaceDecors(IBlockAccessor, BlockPos)
public virtual void PlaceDecors(IBlockAccessor blockAccessor, BlockPos startPos)
Parameters
blockAccessorIBlockAccessorstartPosBlockPos
PlaceDecors(IBlockAccessor, BlockPos, Rectanglei)
public virtual void PlaceDecors(IBlockAccessor blockAccessor, BlockPos startPos, Rectanglei rect)
Parameters
blockAccessorIBlockAccessorstartPosBlockPosrectRectanglei
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
blockAccessorIBlockAccessorworldForCollectibleResolveIWorldAccessorstartPosBlockPosblockCodesDictionary<int, AssetLocation>itemCodesDictionary<int, AssetLocation>replaceBlockEntitiesboolreplaceBlocksDictionary<int, Dictionary<int, int>>centerrockblockidintlayerBlockForBlockEntitiesDictionary<BlockPos, Block>resolveImportsboolTurn 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
blockAccessorIBlockAccessorposBlockPosnewBlockBlockreplaceMetabool
Returns
PlaceReplaceAllNoAir(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceAllNoAir(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessorIBlockAccessorposBlockPosnewBlockBlockreplaceMetabool
Returns
PlaceReplaceOnlyAir(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceOnlyAir(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessorIBlockAccessorposBlockPosnewBlockBlockreplaceMetabool
Returns
PlaceReplaceable(IBlockAccessor, BlockPos, Block, bool)
protected virtual int PlaceReplaceable(IBlockAccessor blockAccessor, BlockPos pos, Block newBlock, bool replaceMeta)
Parameters
blockAccessorIBlockAccessorposBlockPosnewBlockBlockreplaceMetabool
Returns
Remap()
public void Remap()
Save(string)
Saves a schematic to a file.
public virtual string Save(string outfilepath)
Parameters
outfilepathstring
Returns
StringEncodeTreeAttribute(ITreeAttribute)
Exports the tree attribute data to a string.
public virtual string StringEncodeTreeAttribute(ITreeAttribute tree)
Parameters
treeITreeAttribute
Returns
StringEncodeTreeAttribute(ITreeAttribute, FastMemoryStream)
public virtual string StringEncodeTreeAttribute(ITreeAttribute tree, FastMemoryStream ms)
Parameters
treeITreeAttributemsFastMemoryStream
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
worldForResolveIWorldAccessoraroundOriginEnumOriginangleintflipAxisEnumAxis?isDungeonbool
TryGetVersionFromRemapKey(string, out SemVer)
public bool TryGetVersionFromRemapKey(string remapKey, out SemVer remapVersion)