public static bool SetBlock(RaycastHit hit, Block block, bool adjacent = false) { Chunk chunk = hit.collider.GetComponent <Chunk>(); if (chunk == null) { return(false); } BlockPos pos = GetBlockPos(hit, adjacent); chunk.world.SetBlock(pos, block, !Config.Toggle.BlockLighting); if (Config.Toggle.BlockLighting) { BlockLight.LightArea(chunk.world, pos); } return(true); }
public static bool SetBlock(BlockPos pos, Block block, World world = null) { if (!world) { world = World.instance; } Chunk chunk = world.GetChunk(pos); if (chunk == null) { return(false); } chunk.world.SetBlock(pos, block, !Config.Toggle.BlockLighting); if (Config.Toggle.BlockLighting) { BlockLight.LightArea(world, pos); } return(true); }