23 lines
986 B
C#
23 lines
986 B
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];
|
|||
|
}
|