using System; using System.Collections.Generic; using System.Text; namespace Substrate.Core { /// /// A container of blocks with set dimensions. /// public interface IBoundedBlockCollection { /// /// Gets the length of the X-dimension of the container. /// int XDim { get; } /// /// Gets the length of the Y-dimension of the container. /// int YDim { get; } /// /// Gets the length of the Z-dimension of the container. /// int ZDim { get; } /// /// Counts all instances of a block with the given type in the bounded block container. /// /// The id (type) of the block to count. /// The count of blocks in the container matching the given id (type). int CountByID (int id); /// /// Gets a basic block from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// A basic from the collection at the given coordinates. IBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a basic within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// A basic acting as a reference directly into the container at the given coordinates. IBlock GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy basic data from. void SetBlock (int x, int y, int z, IBlock block); /// /// Gets a block's id (type) from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The block id (type) from the block container at the given coordinates. int GetID (int x, int y, int z); /// /// Sets a block's id (type) within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The id (type) to assign to a block at the given coordinates. void SetID (int x, int y, int z, int id); /// /// Gets info and attributes on a block's type within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// A instance for the block's type. BlockInfo GetInfo (int x, int y, int z); } /// /// A bounded container of blocks supporting data fields. /// /// public interface IBoundedDataBlockCollection : IBoundedBlockCollection { /// /// Gets a block with data field from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An from the collection at the given coordinates. new IDataBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a block with data field within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An acting as a reference directly into the container at the given coordinates. new IDataBlock GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy data from. void SetBlock (int x, int y, int z, IDataBlock block); /// /// Gets a block's data field from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The data field of a block at the given coordinates. int GetData (int x, int y, int z); /// /// Sets a block's data field within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The data field to assign to a block at the given coordinates. void SetData (int x, int y, int z, int data); /// /// Counts all blocks within a bounded container set to a given id (type) and data value. /// /// The id (type) of blocks to match. /// The data value of blocks to match. /// A count of all blocks in the container matching both conditions. int CountByData (int id, int data); } /// /// A bounded container of blocks supporting dual-source lighting. /// /// public interface IBoundedLitBlockCollection : IBoundedBlockCollection { /// /// Gets a block with lighting information from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An from the collection at the given coordinates. new ILitBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a block with lighting information within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An acting as a reference directly into the container at the given coordinates. new ILitBlock GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy data from. void SetBlock (int x, int y, int z, ILitBlock block); /// /// Gets a block's block-source light value from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The block-source light value of a block at the given coordinates. int GetBlockLight (int x, int y, int z); /// /// Gets a block's sky-source light value from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The sky-source light value of a block at the given coordinates. int GetSkyLight (int x, int y, int z); /// /// Sets a block's block-source light value within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The block-source light value to assign to a block at the given coordinates. void SetBlockLight (int x, int y, int z, int light); /// /// Sets a block's sky-source light value within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The sky-source light value to assign to a block at the given coordinates. void SetSkyLight (int x, int y, int z, int light); /// /// Gets the Y-coordinate of the lowest block with unobstructed view of the sky at the given coordinates within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Z-coordinate of a block. /// The height value of an X-Z coordinate pair in the block container. /// The height value represents the lowest block with an unobstructed view of the sky. This is the lowest block with /// a maximum-value sky-light value. Fully transparent blocks, like glass, do not count as an obstruction. int GetHeight (int x, int z); /// /// Sets the Y-coordinate of the lowest block with unobstructed view of the sky at the given coordinates within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Z-coordinate of a block. /// The height value of an X-Z coordinate pair in the block container. /// Minecraft lighting algorithms rely heavily on this value being correct. Setting this value too low may result in /// rooms that can never get dark, for example. void SetHeight (int x, int z, int height); /// /// Recalculates the block-source light value of a single block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The lighting of the block will be updated to be consistent with the lighting in neighboring blocks. /// If the block is itself a light source, many nearby blocks may be updated to maintain consistent lighting. These /// updates may also touch neighboring objects, if they can be resolved. /// This function assumes that the entire and neighboring s /// already have consistent lighting, with the exception of the block being updated. If this assumption is violated, /// lighting may fail to converge correctly. void UpdateBlockLight (int x, int y, int z); /// /// Recalculates the sky-source light value of a single block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The lighting of the block will be updated to be consistent with the lighting in neighboring blocks. /// If the block is itself a light source, many nearby blocks may be updated to maintain consistent lighting. These /// updates may also touch neighboring objects, if they can be resolved. /// This function assumes that the entire and neighboring s /// already have consistent lighting, with the exception of the block being updated. If this assumption is violated, /// lighting may fail to converge correctly. void UpdateSkyLight (int x, int y, int z); /// /// Resets the block-source light value to 0 for all blocks within a bounded block container. /// void ResetBlockLight (); /// /// Resets the sky-source light value to 0 for all blocks within a bounded block container. /// void ResetSkyLight (); /// /// Reconstructs the block-source lighting for all blocks within a bounded block container. /// /// This function should only be called after the lighting has been reset in this /// and all neighboring s, or lighting may fail to converge correctly. /// This function cannot reset the lighting on its own, due to interactions between s. /// If many light source or block opacity values will be modified in this , it may /// be preferable to avoid explicit or implicit calls to and call this function once when /// modifications are complete. /// void RebuildBlockLight (); /// /// Reconstructs the sky-source lighting for all blocks within a bounded block container. /// /// This function should only be called after the lighting has been reset in this /// and all neighboring s, or lighting may fail to converge correctly. /// This function cannot reset the lighting on its own, due to interactions between s. /// If many light source or block opacity values will be modified in this , it may /// be preferable to avoid explicit or implicit calls to and call this function once when /// modifications are complete. /// void RebuildSkyLight (); /// /// Reconstructs the height-map for a bounded block container. /// void RebuildHeightMap (); /// /// Reconciles any block-source lighting inconsistencies between this and any of its neighbors. /// /// It will be necessary to call this function if an is reset and rebuilt, but /// some of its neighbors are not. A rebuilt will spill lighting updates into its neighbors, /// but will not see lighting that should be propagated back from its neighbors. /// void StitchBlockLight (); /// /// Reconciles any sky-source lighting inconsistencies between this and any of its neighbors. /// /// It will be necessary to call this function if an is reset and rebuilt, but /// some of its neighbors are not. A rebuilt will spill lighting updates into its neighbors, /// but will not see lighting that should be propagated back from its neighbors. /// void StitchSkyLight (); /// /// Reconciles any block-source lighting inconsistencies between this and another on a given edge. /// /// An -compatible object with the same dimensions as this . /// The edge that is a neighbor on. /// It will be necessary to call this function if an is reset and rebuilt, but /// some of its neighbors are not. A rebuilt will spill lighting updates into its neighbors, /// but will not see lighting that should be propagated back from its neighbors. /// void StitchBlockLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge); /// /// Reconciles any sky-source lighting inconsistencies between this and another on a given edge. /// /// An -compatible object with the same dimensions as this . /// The edge that is a neighbor on. /// It will be necessary to call this function if an is reset and rebuilt, but /// some of its neighbors are not. A rebuilt will spill lighting updates into its neighbors, /// but will not see lighting that should be propagated back from its neighbors. /// void StitchSkyLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge); } /// /// A bounded container for blocks supporting additional properties. /// /// public interface IBoundedPropertyBlockCollection : IBoundedBlockCollection { /// /// Gets a block supporting extra properties from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An from the collection at the given coordinates. new IPropertyBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a block supporting extra properties within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An acting as a reference directly into the container at the given coordinates. new IPropertyBlock GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy data from. void SetBlock (int x, int y, int z, IPropertyBlock block); /// /// Gets the record of a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// A record attached to a block at the given coordinates, or null if no tile entity is set. TileEntity GetTileEntity (int x, int y, int z); /// /// Sets a record to a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The record to assign to the given block. /// Thrown when an incompatible is added to a block. /// Thrown when a is added to a block that does not use tile entities. void SetTileEntity (int x, int y, int z, TileEntity te); /// /// Creates a new default record for a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// Thrown when a is created for a block that does not use tile entities. /// Thrown when the tile entity type associated with the given block has not been registered with . void CreateTileEntity (int x, int y, int z); /// /// Deletes a record associated with a block within a bounded block container, if it exists. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. void ClearTileEntity (int x, int y, int z); } /// /// A bounded container for blocks supporting active processing properties. /// /// public interface IBoundedActiveBlockCollection : IBoundedBlockCollection { /// /// Gets a block supporting active processing properties from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An from the collection at the given coordinates. new IActiveBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a block supporting active processing properties within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An acting as a reference directly into the container at the given coordinates. new IActiveBlock GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy data from. void SetBlock (int x, int y, int z, IActiveBlock block); /// /// Gets the record of a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// A record attached to a block at the given coordinates, or null if no tile entity is set. TileTick GetTileTick (int x, int y, int z); /// /// Sets a record to a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The record to assign to the given block. void SetTileTick (int x, int y, int z, TileTick tt); /// /// Creates a new default record for a block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. void CreateTileTick (int x, int y, int z); /// /// Deletes a record associated with a block within a bounded block container, if it exists. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. void ClearTileTick (int x, int y, int z); /// /// Gets the tick delay specified in a block's entry, if it exists. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The tick delay in a block's entry, or 0 if no entry exists. int GetTileTickValue (int x, int y, int z); /// /// Sets the tick delay in a block's entry. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The tick delay that specifies when this block should next be processed for update. void SetTileTickValue (int x, int y, int z, int tickValue); } /// /// A bounded container of blocks supporting data, lighting, and properties. /// /// public interface IBoundedAlphaBlockCollection : IBoundedDataBlockCollection, IBoundedLitBlockCollection, IBoundedPropertyBlockCollection { /// /// Gets a context-sensitive Alpha-compatible block from a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An from the collection at the given coordinates. new AlphaBlock GetBlock (int x, int y, int z); /// /// Gets a reference object to a context-sensitive Alpha-compatible block within a bounded block container. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// An acting as a reference directly into the container at the given coordinates. new AlphaBlockRef GetBlockRef (int x, int y, int z); /// /// Updates a block in a bounded block container with data from an existing object. /// /// The container-local X-coordinate of a block. /// The container-local Y-coordinate of a block. /// The container-local Z-coordinate of a block. /// The to copy data from. void SetBlock (int x, int y, int z, AlphaBlock block); } }