/// <inheritdoc/> public void SetSkyLight(int x, int y, int z, int light) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.SetSkyLight(x & chunkXMask, y & chunkYMask, z & chunkZMask, light); }
/// <inheritdoc/> public void SetTileEntity(int x, int y, int z, TileEntity te) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.SetTileEntity(x & chunkXMask, y & chunkYMask, z & chunkZMask, te); }
/// <inheritdoc/> public void SetHeight(int x, int z, int height) { cache = GetChunk(x, 0, z); if (cache == null || !Check(x, 0, z)) { return; } cache.Blocks.SetHeight(x & chunkXMask, z & chunkZMask, height); }
/// <inheritdoc/> public void SetID(int x, int y, int z, int id) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } bool autolight = cache.Blocks.AutoLight; bool autofluid = cache.Blocks.AutoFluid; bool autoTileTick = cache.Blocks.AutoTileTick; cache.Blocks.AutoLight = _autoLight; cache.Blocks.AutoFluid = _autoFluid; cache.Blocks.AutoTileTick = _autoTileTick; cache.Blocks.SetID(x & chunkXMask, y & chunkYMask, z & chunkZMask, id); cache.Blocks.AutoFluid = autofluid; cache.Blocks.AutoLight = autolight; cache.Blocks.AutoTileTick = autoTileTick; }
/// <summary> /// Updates a block with values from a <see cref="AlphaBlock"/> object. /// </summary> /// <param name="x">Global X-coordinate of a block.</param> /// <param name="y">Global Y-coordinate of a block.</param> /// <param name="z">Global Z-coordinate of a block.</param> /// <param name="block">A <see cref="AlphaBlock"/> object to copy block data from.</param> public void SetBlock(int x, int y, int z, AlphaBlock block) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.SetBlock(x & chunkXMask, y & chunkYMask, z & chunkZMask, block); }
/// <inheritdoc/> public void SetData(int x, int y, int z, int data) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.SetData(x & chunkXMask, y & chunkYMask, z & chunkZMask, data); }
/// <inheritdoc/> public TileEntity GetTileEntity(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return null; } return cache.Blocks.GetTileEntity(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public void ClearTileEntity(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.ClearTileEntity(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public BlockInfo GetInfo(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return null; } return cache.Blocks.GetInfo(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public int GetSkyLight(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null) { return 0; } return cache.Blocks.GetSkyLight(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public int GetHeight(int x, int z) { cache = GetChunk(x, 0, z); if (cache == null || !Check(x, 0, z)) { return 0; } return cache.Blocks.GetHeight(x & chunkXMask, z & chunkZMask); }
/// <summary> /// Returns a new <see cref="AlphaBlockRef"/> object from global coordaintes. /// </summary> /// <param name="x">Global X-coordinate of block.</param> /// <param name="y">Global Y-coordinate of block.</param> /// <param name="z">Global Z-coordinate of block.</param> /// <returns>A new <see cref="AlphaBlockRef"/> object representing context-dependent data of a single block.</returns> /// <remarks>Context-depdendent data includes all data associated with this block. Since a <see cref="AlphaBlockRef"/> represents /// a view of a block within this container, any updates to data in the container will be reflected in the <see cref="AlphaBlockRef"/>, /// and vice-versa for updates to the <see cref="AlphaBlockRef"/>.</remarks> public AlphaBlockRef GetBlockRef(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return new AlphaBlockRef(); } return cache.Blocks.GetBlockRef(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public void CreateTileTick(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.CreateTileTick(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public void SetTileTickValue(int x, int y, int z, int tickValue) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.SetTileTickValue(x & chunkXMask, y & chunkYMask, z & chunkZMask, tickValue); }
/// <inheritdoc/> public int GetTileTickValue(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return 0; } return cache.Blocks.GetTileTickValue(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <inheritdoc/> public void UpdateSkyLight(int x, int y, int z) { cache = GetChunk(x, y, z); if (cache == null || !Check(x, y, z)) { return; } cache.Blocks.UpdateBlockLight(x & chunkXMask, y & chunkYMask, z & chunkZMask); }
/// <summary> /// Create a reference to a chunk stored in a chunk container. /// </summary> /// <param name="container">Chunk container</param> /// <param name="cx">Local X-coordinate of chunk within container.</param> /// <param name="cz">Local Z-coordinate of chunk within container.</param> /// <returns>ChunkRef representing a reference to a physical chunk at the specified location within the container.</returns> public static ChunkRef Create(IChunkContainer container, int cx, int cz) { if (!container.ChunkExists(cx, cz)) { return null; } ChunkRef c = new ChunkRef(); c._container = container; c._cx = cx; c._cz = cz; return c; }