Skip to content

Commit d7cf41b

Browse files
committed
chore: bit of code cleanup
1 parent fd6aa94 commit d7cf41b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreenPanel.java

-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ public ChunkScreenPanel(ChunkScreen panel) {
6363

6464
this.isAdminEnabled = Minecraft.getInstance().isSingleplayer();
6565

66-
6766
MapManager.getInstance().ifPresent(m -> m.updateAllRegions(false));
6867

6968
alignWidgets();
70-
7169
}
7270

7371
public static void notifyChunkUpdates(int totalChunks, int changedChunks, EnumMap<ClaimResult.StandardProblem, Integer> problems) {

common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointEditorScreen.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class WaypointEditorScreen extends AbstractButtonListScreen {
4545
private final Map<ResourceKey<Level>, Boolean> collapsed = new HashMap<>();
4646
private final Map<ResourceKey<Level>, List<WaypointImpl>> waypoints = new HashMap<>();
4747
private final Button buttonCollapseAll, buttonExpandAll;
48-
private int widestWp = 0;
48+
private int widestWaypoint = 0;
4949

5050
public WaypointEditorScreen() {
5151
showBottomPanel(false);
@@ -56,19 +56,19 @@ public WaypointEditorScreen() {
5656
waypoints.put(resourceKeyListEntry.getKey(), new ArrayList<>(resourceKeyListEntry.getValue()));
5757
}
5858

59-
calcWidestWpText();
59+
computeWaypointTextWidth();
6060

6161
buttonExpandAll = new SimpleButton(topPanel, List.of(Component.translatable("gui.expand_all"), hotkeyTooltip("="), hotkeyTooltip("+")), Icons.UP,
6262
(widget, button) -> toggleAll(true));
6363
buttonCollapseAll = new SimpleButton(topPanel, List.of(Component.translatable("gui.collapse_all"), hotkeyTooltip("-")), Icons.DOWN,
6464
(widget, button) -> toggleAll(false));
6565
}
6666

67-
private void calcWidestWpText() {
68-
widestWp = 0;
67+
private void computeWaypointTextWidth() {
68+
widestWaypoint = 0;
6969
for (var dimKey : waypoints.entrySet()) {
7070
for (var wp : dimKey.getValue()) {
71-
widestWp = Math.max(widestWp, getTheme().getStringWidth(wp.getName()));
71+
widestWaypoint = Math.max(widestWaypoint, getTheme().getStringWidth(wp.getName()));
7272
}
7373
}
7474
}
@@ -94,7 +94,7 @@ protected void doAccept() {
9494

9595
@Override
9696
public boolean onInit() {
97-
setWidth(Mth.clamp(widestWp + 80, 220, getScreen().getGuiScaledWidth() * 4 / 5));
97+
setWidth(Mth.clamp(widestWaypoint + 80, 220, getScreen().getGuiScaledWidth() * 4 / 5));
9898
setHeight(getScreen().getGuiScaledHeight() * 4 / 5);
9999
return true;
100100
}
@@ -306,7 +306,7 @@ public boolean mousePressed(MouseButton button) {
306306
if (accepted) {
307307
wp.setName(config.getValue());
308308
}
309-
calcWidestWpText();
309+
computeWaypointTextWidth();
310310
openGui();
311311
});
312312
}));

0 commit comments

Comments
 (0)