Apotheosis

Apotheosis

70M Downloads

Unbalanced brackets in `/apoth loot_category` output when no item in main hand

James103 opened this issue ยท 1 comments

commented

To reproduce:

  1. Create a new instance with Minecraft 1.18.2 or 1.19.2 and Forge 40.1.84.
  2. Install Apotheosis, latest version for the respective Minecraft version. For 1.18.2, the version I used was 5.7.6.
  3. Install Placebo, latest version for the respective Minecraft version. For 1.18.2, the version I used was 6.6.6.
  4. Create a new world with cheats enabled.
  5. Give yourself a valid tool or armor item and another item such as a dirt block.
  6. Run /apoth loot_category while holding the tool or armor item.
  7. Notice the output is correct and has balanced brackets.
  8. Run /apoth loot_category while not holding a valid tool or armor item.
  9. Notice the output is truncated at Equipment Slot - { with no closing }.

Caused by the following function appending a { unconditionally but only conditionally appending its matching }:

static String toStr(EquipmentSlot[] slots) {
StringBuilder b = new StringBuilder();
b.append('{');
for (int i = 0; i < slots.length; i++) {
b.append(slots[i].name().toLowerCase());
if (i == slots.length - 1) {
b.append('}');
} else b.append(", ");
}
return b.toString();
}

commented

Is this like... something that matters for anything? This is an internal debug command that I don't really support for any reason.