Exemplo n.º 1
0
        /// <summary>
        ///     Handles the respawn.
        /// </summary>
        /// <param name="msg">The MSG.</param>
        private void HandleRespawn(McpeRespawn msg)
        {
            // reset all health states
            HealthManager.ResetHealth();

            // send teleport to spawn
            KnownPosition = new PlayerLocation
            {
                X       = Level.SpawnPoint.X,
                Y       = Level.SpawnPoint.Y,
                Z       = Level.SpawnPoint.Z,
                Yaw     = 91,
                Pitch   = 28,
                HeadYaw = 91
            };

            SendSetHealth();

            SendPackage(new McpeAdventureSettings {
                flags = Level.IsSurvival ? 0x20 : 0x80
            });
            //SendPackage(new McpeAdventureSettings { flags = Level.IsSurvival ? 0x80 : 0x80 });

            SendPackage(new McpeContainerSetContent
            {
                windowId   = 0,
                slotData   = Inventory.Slots,
                hotbarData = Inventory.ItemHotbar
            });

            SendPackage(new McpeContainerSetContent
            {
                windowId   = 0x78,               // Armor windows ID
                slotData   = Inventory.Armor,
                hotbarData = null
            });

            BroadcastSetEntityData();

            // Broadcast spawn to all
            Level.AddPlayer(this);

            SendMovePlayer();
        }
Exemplo n.º 2
0
 public HealthEventArgs(HealthManager healthManager, Entity sourceEntity, Entity targetEntity)
 {
     SourceEntity = sourceEntity;
     TargetEntity = targetEntity;
     HealthManager = healthManager;
 }
Exemplo n.º 3
0
 public HealthEventArgs(HealthManager healthManager, Entity sourceEntity, Entity targetEntity)
 {
     SourceEntity  = sourceEntity;
     TargetEntity  = targetEntity;
     HealthManager = healthManager;
 }