mcdiscordbot/MinecraftDiscordBot/Models/Fluid.cs
Michael Chen 735bc8e8ae
Bump version to 1.1.2
Cleaner item list display
Allow full item list as file
Fixed online status message with new handler
2022-01-18 11:46:23 +01:00

25 lines
1.1 KiB
C#

using Newtonsoft.Json;
using System.Diagnostics;
namespace MinecraftDiscordBot.Models;
[JsonObject(MemberSerialization.OptIn, Description = "Describes a fluid in a Refined Storage system.", MissingMemberHandling = MissingMemberHandling.Ignore)]
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
public class Fluid {
[JsonProperty("amount", Required = Required.Always)]
public int Amount { get; set; }
[JsonProperty("displayName", Required = Required.Always)]
public string DisplayName { get; set; } = default!;
[JsonProperty("tags", Required = Required.DisallowNull)]
public string[]? Tags { get; set; } = default;
[JsonProperty("name", Required = Required.Always)]
public ModItemId ItemId { get; set; } = default!;
public override string ToString() => Amount > 10000
? $"{Amount / 1000.0f:n2} B of {DisplayName}"
: $"{Amount:n0} mB of {DisplayName}";
[JsonIgnore]
public string CleanDisplayName => DisplayName[1..^1];
[JsonIgnore]
public string? TagString => Tags is string[] tags ? string.Join(", ", tags) : null;
}