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); }
public virtual void SendHungerAttributes() { var attributes = AddHungerAttributes(new PlayerAttributes()); McpeUpdateAttributes attributesPackate = McpeUpdateAttributes.CreateObject(); attributesPackate.runtimeEntityId = EntityManager.EntityIdSelf; attributesPackate.attributes = attributes; Player.SendPacket(attributesPackate); }
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); }
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); }
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); }
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); }