internal void Init(string name, ushort width, ushort height, ushort length) { if (width < 1) { width = 1; } if (height < 1) { height = 1; } if (length < 1) { length = 1; } Width = width; Height = height; Length = length; for (int i = 0; i < CustomBlockDefs.Length; i++) { CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i]; } if (blocks == null) { blocks = new byte[width * height * length]; } LoadDefaultProps(); for (int i = 0; i < blockAABBs.Length; i++) { blockAABBs[i] = Block.BlockAABB((ushort)i, this); } UpdateAllBlockHandlers(); this.name = name; MapName = name.ToLower(); BlockDB = new BlockDB(this); ChunksX = Utils.CeilDiv16(width); ChunksY = Utils.CeilDiv16(height); ChunksZ = Utils.CeilDiv16(length); if (CustomBlocks == null) { CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][]; } spawnx = (ushort)(width / 2); spawny = (ushort)(height * 0.75f); spawnz = (ushort)(length / 2); rotx = 0; roty = 0; VisitAccess = new LevelAccessController(Config, name, true); BuildAccess = new LevelAccessController(Config, name, false); listCheckExists = new SparseBitSet(width, height, length); listUpdateExists = new SparseBitSet(width, height, length); }
public Level(string name, ushort width, ushort height, ushort length) { if (width < 1) { width = 1; } if (height < 1) { height = 1; } if (length < 1) { length = 1; } Width = width; Height = height; Length = length; for (int i = 0; i < CustomBlockDefs.Length; i++) { CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i]; } LoadCoreProps(); for (int i = 0; i < blockAABBs.Length; i++) { ExtBlock block = ExtBlock.FromIndex(i); blockAABBs[i] = Block.BlockAABB(block, this); } UpdateBlockHandlers(); this.name = name; MapName = name.ToLower(); BlockDB = new BlockDB(this); Config.EdgeLevel = (short)(height / 2); Config.CloudsHeight = (short)(height + 2); blocks = new byte[Width * Height * Length]; ChunksX = Utils.CeilDiv16(Width); ChunksY = Utils.CeilDiv16(Height); ChunksZ = Utils.CeilDiv16(Length); CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][]; spawnx = (ushort)(Width / 2); spawny = (ushort)(Height * 0.75f); spawnz = (ushort)(Length / 2); rotx = 0; roty = 0; VisitAccess = new LevelAccessController(this, true); BuildAccess = new LevelAccessController(this, false); listCheckExists = new SparseBitSet(Width, Height, Length); listUpdateExists = new SparseBitSet(Width, Height, Length); }