Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.3.7.3 (2026-09-14)

### Fixed

- The World Backups icon on the pause and title screens stays at the end of
the icon row when other mods add or move icons after WorldArchive placed
it. Before, a mod that changed the row later could leave the icon off to
the right of the others.

## 0.3.7.2 (2026-09-10)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ loom_version=1.17.19
fabric_api_version=0.157.0+26.2
modmenu_version=20.0.1

mod_version=0.3.7.2
mod_version=0.3.7.3
maven_group=dev.ishaanko
automatic_release_channel=alpha
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,30 @@ private static void afterInit(Minecraft minecraft, Screen screen, int width, int
}
int size = Math.max(WorldArchiveIconButton.SIZE, iconRow.getFirst().getHeight());
Button backups = WorldArchiveIconButton.create(0, iconRow.getFirst().getY(), size, action);
List<Button> row = new ArrayList<>(iconRow);
row.add(backups);
recenter(row, rowCenter(iconRow), iconRow.getFirst().getY(), width);
Screens.getWidgets(screen).add(backups);
int centerX = rowCenter(iconRow);
layoutRow(screen, backups, centerX, width);
// Other mods may add or move icons after this hook ran. Laying the row out again
// before every frame keeps the shortcut at the end of the row no matter who ran last.
ScreenEvents.beforeExtract(screen).register(
(current, graphics, mouseX, mouseY, delta) ->
layoutRow(current, backups, centerX, width));
}

/**
* Puts the shortcut after every other square icon on its own row, then recenters the
* row. Only that row is touched, so icons elsewhere on the screen are never moved.
*/
private static void layoutRow(Screen screen, Button backups, int centerX, int screenWidth) {
int y = backups.getY();
List<Button> row = Screens.getWidgets(screen).stream()
.filter(Button.class::isInstance)
.map(Button.class::cast)
.filter(button -> button != backups && button.getY() == y && isSquareIcon(button))
.sorted(Comparator.comparingInt(Button::getX))
.collect(Collectors.toCollection(ArrayList::new));
row.add(backups);
recenter(row, centerX, y, screenWidth);
}

/**
Expand Down