示例#1
0
        private void SendAttributes()
        {
            if (Progress == 0)
            {
                Progress = 1;
            }

            var attributes = new PlayerAttributes
            {
                ["minecraft:health"] = new PlayerAttribute
                {
                    Name     = "minecraft:health",
                    MinValue = 0,
                    MaxValue = MaxProgress,
                    Value    = Progress,
                    Default  = MaxProgress
                }
            };

            var attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.runtimeEntityId = EntityId;
            attributesPackate.attributes      = attributes;
            Level?.RelayBroadcast(attributesPackate);
        }
示例#2
0
 public override void HandleMcpeUpdateAttributes(McpeUpdateAttributes message)
 {
     foreach (var playerAttribute in message.attributes)
     {
         Log.Debug($"Attribute {playerAttribute}");
     }
 }
示例#3
0
        public virtual void SendHungerAttributes()
        {
            var attributes = AddHungerAttributes(new PlayerAttributes());

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.runtimeEntityId = EntityManager.EntityIdSelf;
            attributesPackate.attributes      = attributes;
            Player.SendPacket(attributesPackate);
        }
示例#4
0
        public virtual void SendHungerAttributes()
        {
            var attributes = AddHungerAttributes(new PlayerAttributes());

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.entityId   = 0;
            attributesPackate.attributes = attributes;
            Player.SendPackage(attributesPackate);
        }
        public virtual void SendUpdateAttributes()
        {
            var attributes = new PlayerAttributes();

            attributes["minecraft:health"] = new PlayerAttribute
            {
                Name     = "minecraft:health",
                MinValue = 0,
                MaxValue = HealthManager.MaxHealth,
                Value    = HealthManager.Hearts,
                Unknown  = HealthManager.MaxHealth,
            };

            // Workaround, bad design.

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.entityId   = EntityId;
            attributesPackate.attributes = attributes;
            Level.RelayBroadcast(attributesPackate);
        }
示例#6
0
        public virtual void SendAttributes(Level level)
        {
            PlayerAttributes attributes;

            if (level is xCoreLevel)
            {
                attributes = new PlayerAttributes();
                attributes["minecraft:health"] = new PlayerAttribute
                {
                    Name     = "minecraft:health",
                    MinValue = 0,
                    MaxValue = ((xCoreLevel)level).MaxInt,
                    Value    = ((xCoreLevel)level).Int,
                    Default  = ((xCoreLevel)level).MaxInt
                };
            }
            else
            {
                attributes = new PlayerAttributes();
                attributes["minecraft:health"] = new PlayerAttribute
                {
                    Name     = "minecraft:health",
                    MinValue = 0,
                    MaxValue = 20,
                    Value    = 20,
                    Default  = 20
                };
            }

            // Workaround, bad design.

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.runtimeEntityId = EntityId;
            attributesPackate.attributes      = attributes;
            level.RelayBroadcast(attributesPackate);
            //player.SendPackage(attributesPackate);
        }
示例#7
0
        public virtual void SendAttributes(Player player)
        {
            var attributes = new PlayerAttributes
            {
                ["minecraft:health"] = new PlayerAttribute
                {
                    Name     = "minecraft:health",
                    MinValue = 0,
                    MaxValue = 20,
                    Value    = 20,
                    Default  = 20
                }
            };

            // Workaround, bad design.

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.runtimeEntityId = EntityId;
            attributesPackate.attributes      = attributes;
            //Level.RelayBroadcast(attributesPackate);
            player.SendPackage(attributesPackate);
        }
示例#8
0
        public virtual void SendHungerAttributes()
        {
            var attributes = new PlayerAttributes();

            attributes["player.hunger"] = new PlayerAttribute
            {
                Name = "player.hunger", MinValue = MinHunger, MaxValue = MaxHunger, Value = Hunger
            };
            attributes["player.saturation"] = new PlayerAttribute
            {
                Name = "player.saturation", MinValue = 0, MaxValue = Hunger, Value = (float)Saturation
            };
            attributes["player.exhaustion"] = new PlayerAttribute
            {
                Name = "player.exhaustion", MinValue = 0, MaxValue = 5, Value = (float)Exhaustion
            };

            McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject();

            attributesPackate.entityId   = 0;
            attributesPackate.attributes = attributes;
            Player.SendPackage(attributesPackate);
        }
示例#9
0
 public void SendUpdateAttributes(McpeUpdateAttributes packet, Player player)
 {
     SendNameTag(player);
 }
示例#10
0
 public virtual void HandleMcpeUpdateAttributes(McpeUpdateAttributes message)
 {
 }
示例#11
0
 public void SendUpdateAttributes(McpeUpdateAttributes packet, Player player)
 {
     SendNameTag(player);
 }
示例#12
0
 private void OnMcpeUpdateAttributes(McpeUpdateAttributes message)
 {
     foreach (var playerAttribute in message.attributes)
     {
         Log.Debug($"Attribute {playerAttribute}");
     }
 }
 public abstract void HandleMcpeUpdateAttributes(McpeUpdateAttributes message);
示例#14
0
 public override void HandleMcpeUpdateAttributes(McpeUpdateAttributes message)
 {
     UnhandledPackage(message);
 }
示例#15
0
 public override void HandleMcpeUpdateAttributes(McpeUpdateAttributes message)
 {
 }