public ChunkSection PlaceBlock(Coord3 worldPos, BlockData data, bool updateChunk = true) { var sectionPos = worldPos.WorldToChunk(); var section = chunks.GetSection(sectionPos); if (section == null) { return(null); } section.blocks.PlaceBlock(worldPos.WorldToBlock(section.worldPosition), data, updateChunk); return(section); }
public Block GetBlock(Coord3 pos) { var chunkPos = pos.WorldToChunk(); var chunk = chunks.GetSection(chunkPos); if (chunk == null) { return(null); } var blockPos = pos.WorldToBlock(chunk.worldPosition); return(chunk.blocks.GetBlock(blockPos)); }
public Block GetBlock(RaycastHit hit, bool adjacent = false) { var pos = Coord3.RaycastToBlock(hit, adjacent); return(GetBlock(pos)); }
public ChunkSection PlaceBlock(RaycastHit hit, BlockData data, out Block block, bool adjacent = false) { var pos = Coord3.RaycastToBlock(hit, adjacent); return(PlaceBlock(pos, data, out block, true)); }