Reduced string concatenation
Reduce the amount of string concatenation when converting an ItemStack to a string.
This commit is contained in:
parent
483cc7b763
commit
105b0f57d0
@ -252,11 +252,14 @@ namespace TrueCraft.API
|
||||
{
|
||||
if (Empty)
|
||||
return "(Empty)";
|
||||
string result = "ID: " + ID;
|
||||
if (Count != 1) result += "; Count: " + Count;
|
||||
if (Metadata != 0) result += "; Metadata: " + Metadata;
|
||||
if (Nbt != null) result += Environment.NewLine + Nbt.ToString();
|
||||
return "(" + result + ")";
|
||||
|
||||
StringBuilder resultBuilder = new StringBuilder("ID: " + ID);
|
||||
|
||||
if (Count != 1) resultBuilder.Append("; Count: " + Count);
|
||||
if (Metadata != 0) resultBuilder.Append("; Metadata: " + Metadata);
|
||||
if (Nbt != null) resultBuilder.Append(Environment.NewLine + Nbt.ToString());
|
||||
|
||||
return "(" + resultBuilder.ToString() + ")";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user