public IEnumerable <BlockProfile> GetAllCubesProfiles() { foreach (var profile in BlockProfiles.Where(x => x != null && x.Name != "System Reserved")) { yield return(profile); } }
public BlockProfile CreateNewCube(BlockProfile copyFrom = null) { //Get New Cube ID. //We keep the id from 0 to 99 for "System" cubes //101 to 254 for Custom created cubes byte newProfileId = (byte)(BlockProfiles.Where(x => x != null).Max(x => x.Id) + 1); BlockProfile newCubeProfile = copyFrom ?? new BlockProfile() { Name = "NewCustomCube", Id = newProfileId, Tex_Top = new TextureData(), Tex_Bottom = new TextureData(), Tex_Back = new TextureData(), Tex_Front = new TextureData(), Tex_Left = new TextureData(), Tex_Right = new TextureData(), LightAbsorbed = 255, IsPickable = true, IsSolidToEntity = true, IsBlockingWater = true, CubeFamilly = Enums.enuCubeFamilly.Solid, Friction = 0.25f, IsSystemCube = false }; if (copyFrom != null) { newCubeProfile.Id = newProfileId; newCubeProfile.IsSystemCube = false; } if (BlockProfiles.Length <= newProfileId) { var array = BlockProfiles; Array.Resize(ref array, newProfileId + 1); BlockProfiles = array; } BlockProfiles[newProfileId] = newCubeProfile; return(newCubeProfile); }