Skip to content

Commit 683f599

Browse files
committed
Fix position and size of selection list
1 parent dc56cea commit 683f599

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

‎src/main/java/com/chaosthedude/explorerscompass/gui/ExplorersCompassScreen.java‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public ExplorersCompassScreen(Level level, Player player, ItemStack stack, Explo
6262
}
6363
}
6464

65-
@Override
66-
public boolean mouseScrolled(double par1, double par2, double par3, double par4) {
67-
return selectionList.mouseScrolled(par1, par2, par3, par4);
68-
}
69-
7065
@Override
7166
protected void init() {
7267
setupWidgets();
@@ -82,8 +77,7 @@ public void tick() {
8277
removeWidget(selectionList);
8378
allowedStructures = new ArrayList<Identifier>(ExplorersCompass.allowedStructures);
8479
structuresMatchingSearch = new ArrayList<Identifier>(allowedStructures);
85-
selectionList = new StructureSearchList(this, minecraft, player, foundStructureId, width + 110, height - 50, 40, 50);
86-
addRenderableWidget(selectionList);
80+
selectionList = addRenderableWidget(new StructureSearchList(this, minecraft, player, foundStructureId, 130, 40, width - 140, height - 50, 50));
8781

8882
teleportButton.visible = ExplorersCompass.canTeleport;
8983
searchForNextButton.visible = ExplorersCompass.maxNextSearches > 0;
@@ -210,11 +204,8 @@ private void setupWidgets() {
210204
}));
211205

212206
searchBox = addRenderableWidget(new TransparentEditBox(font, 130, 10, 140, 20, Component.translatable("string.explorerscompass.search").withColor(0xff808080)));
213-
214-
if (selectionList == null) {
215-
selectionList = new StructureSearchList(this, minecraft, player, foundStructureId, width + 110, height - 50, 40, 50);
216-
}
217-
addRenderableWidget(selectionList);
207+
208+
selectionList = addRenderableWidget(new StructureSearchList(this, minecraft, player, foundStructureId, 130, 40, width - 140, height - 50, 50));
218209
}
219210

220211
}

‎src/main/java/com/chaosthedude/explorerscompass/gui/StructureSearchList.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ public class StructureSearchList extends ObjectSelectionList<StructureSearchEntr
1414
private final ExplorersCompassScreen parentScreen;
1515
private Player player;
1616

17-
public StructureSearchList(ExplorersCompassScreen parentScreen, Minecraft mc, Player player, Identifier structureIdToSelect, int width, int height, int y, int itemHeight) {
17+
public StructureSearchList(ExplorersCompassScreen parentScreen, Minecraft mc, Player player, Identifier structureIdToSelect, int x, int y, int width, int height, int itemHeight) {
1818
super(mc, width, height, y, itemHeight);
1919
this.parentScreen = parentScreen;
2020
this.player = player;
21+
setX(x);
2122
refreshList(structureIdToSelect);
2223
}
2324

@@ -28,7 +29,7 @@ protected int scrollBarX() {
2829

2930
@Override
3031
public int getRowWidth() {
31-
return 270;
32+
return getWidth();
3233
}
3334

3435
@Override

0 commit comments

Comments
 (0)