public Block(World world, BlockLocation location, int id = 1, bool isTransparent = false) { ShouldRender = true; World = world; Location = location; ID = id; //Hardness = hardness; //Resistance = resistance; IsTransparent = isTransparent; if (location.Chunk != null) { BlockLocation blockLocation = GridLatch.GetBlockOffsetByChunk(location, location.Chunk.Location); BoundingBox = new AxisAlignedBB(blockLocation); } }
/// <summary> /// Creates a copy of the block, copying all the block data over (AABB, id, etc), with the optional ability to copy metadate /// </summary> /// <param name="block"></param> /// <param name="world"></param> /// <param name="location"></param> /// <param name="copyMetadata"></param> /// <returns></returns> public static Block CreateCopy(Block block, World world, BlockLocation location, bool copyMetadata = true) { Block newBlock = new Block( world, location, block.ID, block.IsTransparent) { BoundingBox = block.BoundingBox }; if (copyMetadata) { newBlock.Metadata = block.Metadata; } return(newBlock); }
public BlockLocation Translated(BlockLocation location) { return(new BlockLocation(Chunk, X + location.X, Y + location.Y, Z + location.Z)); }