public abstract SetTileEntity ( TileEntity e ) : void | ||
e | TileEntity | |
Результат | void |
/// <summary> /// Generate a chunk /// </summary> /// <param name="CX">Chunk X</param> /// <param name="CZ">Chunk Z</param> /// <param name="b">Blocks</param> /// <param name="mh">Map handler</param> /// <param name="r">Random</param> /// <returns></returns> public static bool MakeDungeon(int CX, int CZ, ref byte[, ,] b, ref IMapHandler mh, Random r) { int CH = (int)mh.ChunkScale.X; int CV = (int)mh.ChunkScale.Y; int x = r.Next(0 + DungeonSizeX - 1, CH - DungeonSizeX + 1); int y = r.Next(0 + DungeonSizeY - 1, CV - DungeonSizeY + 1); int z = r.Next(0 + DungeonSizeZ - 1, CH - DungeonSizeZ + 1); Vector3i position = mh.Local2Global(CX, CZ, new Vector3i(x, y, z)); //Console.WriteLine("Creating dungeon in {0}...", position); if (!CheckForDungeonSpace(b, x, y, z)) { return(false); } Vector3i size = new Vector3i((DungeonSizeX * 2) + 1, (DungeonSizeY * 2) + 1, (DungeonSizeZ * 2) + 1); Vector3i sizeAir = new Vector3i(size.X - 1, size.Y - 1, size.Z - 1); FillRect(ref b, 48, position, size); // Do walls (RANDOMIZE) FillRect(ref b, 0, position, sizeAir); // Add air MobSpawner ms = new MobSpawner(); ms.Delay = 20; ms.EntityId = Entity.GetRandomMonsterID(r); ms.Pos = mh.Local2Global(CX, CZ, new Vector3i(x, y - DungeonSizeZ + 1, z)); ms.UUID = Guid.NewGuid(); mh.SetTileEntity(ms); b[x, y - DungeonSizeZ + 1, z] = 52; return(true); }
/// <summary> /// Gen a dungeon /// </summary> /// <param name="CX">Chunk X pos</param> /// <param name="CY">Chunk Y pos</param> /// <param name="CH">Chunk Horizontal Scale</param> /// <param name="b"></param> /// <param name="mh"></param> /// <param name="r"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> /// <returns></returns> public static bool MakeDungeon(int CX, int CY, ref byte[, ,] b, ref IMapHandler mh, Random r) { int CH = (int)mh.ChunkScale.X; int CV = (int)mh.ChunkScale.Z; int x = r.Next(0+DungeonSizeX-1, CH-DungeonSizeX+1); int y = r.Next(0+DungeonSizeY-1, CH-DungeonSizeY+1); int z = r.Next(0+DungeonSizeZ-1, CV-DungeonSizeZ+1); Vector3i position = new Vector3i(x,y,z); //Console.WriteLine("Creating dungeon in {0}...", position); if (!CheckForDungeonSpace(b, x, y, z)) return false; Vector3i size = new Vector3i((DungeonSizeX*2)+1,(DungeonSizeY*2)+1,(DungeonSizeZ*2)+1); FillRect(ref b, 0, position, size); MakeDungeonWalls(ref b, r, position, size); mh.SetTileEntity(new MobSpawner(x+(int)(CX*CH), y+(int)(CY*CH), z-DungeonSizeZ+1, Entity.GetRandomMonsterID(r), 20)); b[x, y, z - DungeonSizeZ + 1]=52; return true; }
/// <summary> /// Generate a chunk /// </summary> /// <param name="CX">Chunk X</param> /// <param name="CZ">Chunk Z</param> /// <param name="b">Blocks</param> /// <param name="mh">Map handler</param> /// <param name="r">Random</param> /// <returns></returns> public static bool MakeDungeon(int CX, int CZ, ref byte[, ,] b, ref IMapHandler mh, Random r) { int CH = (int)mh.ChunkScale.X; int CV = (int)mh.ChunkScale.Y; int x = r.Next(0+DungeonSizeX-1, CH-DungeonSizeX+1); int y = r.Next(0+DungeonSizeY-1, CV-DungeonSizeY+1); int z = r.Next(0+DungeonSizeZ-1, CH-DungeonSizeZ+1); Vector3i position = mh.Local2Global(CX,CZ,new Vector3i(x,y,z)); //Console.WriteLine("Creating dungeon in {0}...", position); if (!CheckForDungeonSpace(b, x, y, z)) return false; Vector3i size = new Vector3i((DungeonSizeX*2)+1,(DungeonSizeY*2)+1,(DungeonSizeZ*2)+1); Vector3i sizeAir = new Vector3i(size.X-1,size.Y-1,size.Z-1); FillRect(ref b, 48, position, size); // Do walls (RANDOMIZE) FillRect(ref b, 0, position, sizeAir); // Add air MobSpawner ms = new MobSpawner(); ms.Delay=20; ms.EntityId=Entity.GetRandomMonsterID(r); ms.Pos = mh.Local2Global(CX,CZ,new Vector3i(x, y - DungeonSizeZ + 1, z)); ms.UUID = Guid.NewGuid(); mh.SetTileEntity(ms); b[x, y - DungeonSizeZ + 1, z] = 52; return true; }