Esempio n. 1
0
        public void SetSpawn(Vector3S location, byte look, byte rot)
        {
            var spawnLoc = new MinecraftLocation(location, rot, look);

            spawnLoc.SetAsBlockCoords(location);
            MapProvider.SetSpawn(spawnLoc);
        }
Esempio n. 2
0
 public void SetSpawn(MinecraftLocation spawnLocation)
 {
     _cwMap.SpawnX        = spawnLocation.Location.X;
     _cwMap.SpawnY        = spawnLocation.Location.Z;
     _cwMap.SpawnZ        = spawnLocation.Location.Y;
     _cwMap.SpawnRotation = spawnLocation.Rotation;
     _cwMap.SpawnLook     = spawnLocation.Look;
 }
Esempio n. 3
0
        // -- Handles events this player is performing
        public void HandleMove(Vector3S location, byte rot, byte look)
        {
            if (location == Entity.Location.Location && rot == Entity.Location.Rotation && Entity.Location.Look == look)
            {
                return;
            }

            var newLoc = new MinecraftLocation(location, rot, look);

            Entity.Location = newLoc;
            Entity.HandleMove();
        }
Esempio n. 4
0
 public void Read(ByteBuffer buf) {
     PlayerId = (sbyte)buf.ReadByte();
     PlayerName = buf.ReadString();
     var temp = new MinecraftLocation();
     var loc = new Vector3S // -- WARNING: This might cause unintended behavior!!
     {
         X = buf.ReadShort(),
         Z = buf.ReadShort(),
         Y = buf.ReadShort()
     };
     temp.SetAsPlayerCoords(loc);
     temp.Rotation = buf.ReadByte();
     temp.Look = buf.ReadByte();
     Location = temp;
 }
Esempio n. 5
0
        private void Test_CreateEntity()
        {
            Entity[] copy = Entity.AllEntities.ToArray();

            foreach (Entity e in copy)
            {
                if (e.Name == "Num1" || e.Name == "Num2")
                {
                    e.Despawn();
                }
            }

            var location1 = new MinecraftLocation();

            location1.SetAsBlockCoords(new Vector3S(40, 40, 20));

            var entity1 = new Entity {
                Name       = "Num1",
                PrettyName = "&cNum1",
                CurrentMap = HcMap.DefaultMap,
                ClientId   = (sbyte)HcMap.DefaultMap.GetEntityId(),
                Location   = location1,
            };

            var entity2 = new Entity {
                Name       = "Num2",
                PrettyName = "&cNum2",
                CurrentMap = HcMap.DefaultMap,
                ClientId   = (sbyte)HcMap.DefaultMap.GetEntityId(),
                Location   = HcMap.DefaultMap.GetSpawn(),
            };

            entity1.Spawn();
            entity2.Spawn();
            entity1.HandleMove();
            entity2.HandleMove();
        }
Esempio n. 6
0
        public void EqualsNegativeCheck()
        {
            var givenOtherMinecraftLocation = new MinecraftLocation(givenVector, 255, 255);

            Assert.AreNotEqual(givenMinecraftLocation, givenOtherMinecraftLocation);
        }
Esempio n. 7
0
        public void EqualsCheck()
        {
            var givenOtherMinecraftLocation = new MinecraftLocation(givenVector, 100, 100);

            Assert.AreEqual(givenMinecraftLocation, givenOtherMinecraftLocation);
        }
Esempio n. 8
0
 public void Setup()
 {
     givenVector            = new Vector3S(100, 100, 100);
     givenMinecraftLocation = new MinecraftLocation(givenVector, 100, 100);
 }
Esempio n. 9
0
 public void SetSpawn(MinecraftLocation spawnLocation)
 {
     _underMap.MapSpawn = spawnLocation;
 }