use of net.minecraft.server.v1_14_R1.NBTBase in project MechanicsMain by WeaponMechanics.
the class NBT_1_13_R2 method visit.
private StringBuilder visit(NBTTagCompound nbt, int indents, int colorOffset) {
String braceColor = "&" + BRACE_COLORS.charAt(indents % BRACE_COLORS.length());
StringBuilder builder = new StringBuilder(braceColor).append('{');
List<String> keys = new ArrayList<>(nbt.getKeys());
Collections.sort(keys);
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
NBTBase value = Objects.requireNonNull(nbt.get(key), "This is impossible");
if (i != 0)
builder.append('\n');
builder.append(StringUtil.repeat(" ", indents));
String color = "&" + VALUE_COLORS.charAt((i + colorOffset) % VALUE_COLORS.length());
builder.append(color).append(key).append("&f&l: ").append(color);
if (value instanceof NBTTagCompound)
builder.append(visit((NBTTagCompound) value, indents + 1, colorOffset + i));
else
builder.append(value);
}
return builder.append(braceColor).append("}\n");
}
use of net.minecraft.server.v1_14_R1.NBTBase in project MechanicsMain by WeaponMechanics.
the class NBT_1_9_R2 method visit.
private StringBuilder visit(NBTTagCompound nbt, int indents, int colorOffset) {
String braceColor = "&" + BRACE_COLORS.charAt(indents % BRACE_COLORS.length());
StringBuilder builder = new StringBuilder(braceColor).append('{');
List<String> keys = new ArrayList<>(nbt.c());
Collections.sort(keys);
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
NBTBase value = Objects.requireNonNull(nbt.get(key), "This is impossible");
if (i != 0)
builder.append('\n');
builder.append(StringUtil.repeat(" ", indents));
String color = "&" + VALUE_COLORS.charAt((i + colorOffset) % VALUE_COLORS.length());
builder.append(color).append(key).append("&f&l: ").append(color);
if (value instanceof NBTTagCompound)
builder.append(visit((NBTTagCompound) value, indents + 1, colorOffset + i));
else
builder.append(value);
}
return builder.append(braceColor).append("}\n");
}
Aggregations