use of net.minecraft.server.v1_16_R3.NBTBase in project MechanicsMain by WeaponMechanics.
the class NBT_1_10_R1 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");
}
use of net.minecraft.server.v1_16_R3.NBTBase in project MechanicsMain by WeaponMechanics.
the class NBT_1_11_R1 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");
}
use of net.minecraft.server.v1_16_R3.NBTBase in project MechanicsMain by WeaponMechanics.
the class NBT_1_12_R1 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");
}
use of net.minecraft.server.v1_16_R3.NBTBase in project RoseStacker by Rosewood-Development.
the class NBTStackedEntityDataStorage method removeDuplicates.
private void removeDuplicates(NBTTagCompound compoundTag) {
for (String key : new ArrayList<>(compoundTag.getKeys())) {
NBTBase baseValue = this.base.get(key);
NBTBase thisValue = compoundTag.get(key);
if (baseValue != null && baseValue.equals(thisValue))
compoundTag.remove(key);
}
}
use of net.minecraft.server.v1_16_R3.NBTBase in project RoseStacker by Rosewood-Development.
the class NBTStackedEntityDataStorage method removeDuplicates.
private void removeDuplicates(NBTTagCompound compoundTag) {
for (String key : new ArrayList<>(compoundTag.getKeys())) {
NBTBase baseValue = this.base.get(key);
NBTBase thisValue = compoundTag.get(key);
if (baseValue != null && baseValue.equals(thisValue))
compoundTag.remove(key);
}
}
Aggregations