Esempio n. 1
0
        protected override ChunkData GenerateChunk()
        {
            Random r = new Random();
            ChunkData mc = new ChunkData();
            mc.Complete = true;
            mc.InitContinousChunks(4);
            //Fill with data
            int off = mc.GetIndex(0, 13, 0);
            for (int i = 0; i < 16*16; i++)
                mc.BlockType [off + i] = (byte)BlockID.SoulSand;
            off += 16 * 16;
            for (int i = 0; i < 16*16; i++)
            {
                if (r.Next(4) > 0)
                    mc.BlockType [off + i] = (byte)BlockID.SoulSand;
                else
                    mc.BlockType [off + i] = (byte)BlockID.Lava;
            }
            off += 16 * 16;
            for (int i = 0; i < 16*16; i++)
            {
                if (r.Next(4) == 0)
                    mc.BlockType [off + i] = (byte)BlockID.Fire;
            }
            for (int n = 0; n < mc.BlockLight.Length; n++)
                mc.BlockLight [n] = 0x88;
            for (int n = 0; n < mc.Biome.Length; n++)
                mc.Biome [n] = 9;
			
            return mc;
        }
Esempio n. 2
0
 protected override ChunkData GenerateChunk()
 {
     Random r = new Random();
     ChunkData mc = new ChunkData();
     mc.Complete = true;
     mc.InitContinousChunks(4);
     //Fill with data
     int off = mc.GetIndex(0, 60, 0);
     for (int i = 0; i < off; i++)
         mc.BlockType [i] = (byte)BlockID.Dirt;
     for (int i = 0; i < 16*16; i++)
         mc.BlockType [off + i] = (byte)BlockID.Grass;
     off += 16 * 16;
     for (int i = 0; i < 16*16; i++)
     {
         if (r.Next(4) == 0)
             mc.BlockType [off + i] = (byte)BlockID.Rose;
         if (r.Next(5) == 0)
             mc.BlockType [off + i] = (byte)BlockID.Dandelion;
     }
     for (int n = 0; n < mc.BlockLight.Length; n++) 
         mc.BlockLight [n] = 0xff;
     for (int i = 0; i < 16*16; i++)
         mc.Biome [i] = (byte)((i >> 3) % 23);
     return mc;
 }
Esempio n. 3
0
        protected override ChunkData GenerateChunk()
        {
            ChunkData mc = new ChunkData();
            mc.Complete = true;
            mc.InitContinousChunks(4);
            //Fill with data
            int off = mc.GetIndex(0, 0, 0);
            for (int i = off; i < off + 64 * 16 * 16; i++)
                mc.BlockType [i] = (byte)BlockID.IronBlock;
            for (int n = 0; n < mc.BlockLight.Length; n++)
                mc.BlockLight [n] = 0xff;
            for (int n = 0; n < mc.BlockSkyLight.Length; n++)
                mc.BlockSkyLight [n] = 0x00;
            for (int n = 0; n < mc.Biome.Length; n++)
                mc.Biome [n] = 9;

            return mc;
        }
Esempio n. 4
0
        protected void SendStartup(ConstructSession cs, Client player)
        {
            //First another dimension to trigger full drop of old map
            Respawn r = new Respawn();
            if (Dimension == Dimensions.Overworld)
                r.Dimension = Dimensions.Nether;
            else
                r.Dimension = Dimensions.Overworld;
            r.Mode = 0;
            r.Difficulty = 3;
            player.Queue.Queue(r);

            r = new Respawn();
            r.Dimension = (Dimensions)Dimension;
            r.Mode = 0;
            r.Difficulty = 3;
            player.Queue.Queue(r);

            //player.Queue.Queue(new SpawnPosition(cs.Position.CloneInt()));
            player.Queue.Queue(new TimeUpdate(18000));
            
            cs.Position.Y = 66;
            
            var ppl = new PlayerPositionLookServer(cs.Position);
            ppl.Yaw = cs.Yaw;
            ppl.Pitch = cs.Pitch;
            player.Queue.Queue(ppl);
            
            player.Queue.Queue(new TimeUpdate(1000));
            
            //player.Queue.Queue(new NewState(NewState.State.EndRaining));
            
            int min = -1;
            int max = 1;
            for (int cx = min; cx < max; cx++)
            {
                for (int cz = min; cz < max; cz++)
                {
                    ChunkData mc = new ChunkData();
                    mc.ChunkBitMap = ChunkData.ChunkBitMap;
                    mc.Complete = ChunkData.Complete;
                    mc.X = cx;
                    mc.Z = cz;
                    mc.BlockType = ChunkData.BlockType;
                    mc.BlockMeta = ChunkData.BlockMeta;
                    mc.BlockLight = ChunkData.BlockLight;
                    mc.BlockSkyLight = ChunkData.BlockSkyLight;
                    mc.Biome = ChunkData.Biome;
                    player.Queue.Queue(mc);
                }
            }

            r = new Respawn();
            r.Dimension = (Dimensions)Dimension;
            r.Mode = 0;
            r.Difficulty = 3;
            player.Queue.Queue(r);

            player.Queue.Queue(new UpdateHealth(20, 20));

            var properties = new EntityProperties(player.EntityID, 0.10, 20.0);
            player.Queue.Queue(properties);
        }
Esempio n. 5
0
 public Construct()
 {
     pingThread = new Timer(PingThread, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
     ChunkData = GenerateChunk();
 }