Skip to content

Commit

Permalink
Update to 1.20.3 + Video settings screen update
Browse files Browse the repository at this point in the history
  • Loading branch information
xCollateral committed Dec 9, 2023
1 parent 4640831 commit dd638f0
Show file tree
Hide file tree
Showing 4 changed files with 458 additions and 274 deletions.
259 changes: 0 additions & 259 deletions src/main/java/net/vulkanmod/config/OptionList2.java

This file was deleted.

29 changes: 18 additions & 11 deletions src/main/java/net/vulkanmod/config/OptionScreenV.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import java.util.Optional;

public class OptionScreenV extends Screen {
private final List<OptionList2> optionLists;
private Option<?>[] videoOpts;
private Option<?>[] graphicsOpts;
private Option<?>[] otherOpts;
private final List<VOptionList> optionLists;
private final Option<?>[] videoOpts;
private final Option<?>[] graphicsOpts;
private final Option<?>[] otherOpts;
private final Screen parent;
private OptionList2 currentList;
private VOptionList currentList;

private CustomButtonWidget videoButton;
private CustomButtonWidget graphicsButton;
Expand Down Expand Up @@ -62,16 +62,21 @@ protected void init() {
int bottom = 32;

this.optionLists.clear();
OptionList2 optionList = new OptionList2(this.minecraft, this.width, this.height, top, this.height - bottom, 25);
VOptionList optionList = new VOptionList(this.minecraft, this.width, this.height, top, bottom, 25);
optionList.addAll(this.videoOpts);
this.optionLists.add(optionList);
optionList = new OptionList2(this.minecraft, this.width, this.height, top, this.height - bottom, 25);
optionList = new VOptionList(this.minecraft, this.width, this.height, top, bottom, 25);
optionList.addAll(this.graphicsOpts);
this.optionLists.add(optionList);
optionList = new OptionList2(this.minecraft, this.width, this.height, top, this.height - bottom, 25);
optionList = new VOptionList(this.minecraft, this.width, this.height, top, bottom, 25);
optionList.addAll(this.otherOpts);
this.optionLists.add(optionList);

// this.optionLists2.clear();
// VOptionList optionList2 = new VOptionList(this.minecraft, this.width, this.height, top, bottom, 25);
// optionList2.addAll(this.videoOpts);
// this.optionLists2.add(optionList2);

this.videoButton = new CustomButtonWidget(20, 6, 60, 20, Component.literal("Video"), button -> this.setOptionList(button, optionLists.get(0)));
this.graphicsButton = new CustomButtonWidget(81, 6, 60, 20, Component.literal("Graphics"), button -> this.setOptionList(button, optionLists.get(1)));
this.otherButton = new CustomButtonWidget(142, 6, 60, 20, Component.literal("Other"), button -> this.setOptionList(button, optionLists.get(2)));
Expand Down Expand Up @@ -155,10 +160,12 @@ public void onClose() {
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) {
this.updateStatus();

this.renderBackground(guiGraphics, 0, 0, 0);

this.currentList.render(guiGraphics, mouseX, mouseY, delta);
renderButtons(guiGraphics, mouseX, mouseY, delta);

List<FormattedCharSequence> list = getHoveredButtonTooltip(this.currentList, mouseX, mouseY);
List<FormattedCharSequence> list = getHoveredButtonTooltip2(this.currentList, mouseX, mouseY);
if (list != null) {
guiGraphics.renderTooltip(this.minecraft.font, list, mouseX, mouseY);
}
Expand All @@ -170,7 +177,7 @@ public void renderButtons(GuiGraphics guiGraphics, int mouseX, int mouseY, float
}
}

private List<FormattedCharSequence> getHoveredButtonTooltip(OptionList2 buttonList, int mouseX, int mouseY) {
private List<FormattedCharSequence> getHoveredButtonTooltip2(VOptionList buttonList, int mouseX, int mouseY) {
Optional<OptionWidget> optional = buttonList.getHoveredButton(mouseX, mouseY);
if (optional.isPresent()) {
if(optional.get().getTooltip() == null) return null;
Expand All @@ -195,7 +202,7 @@ public void updateStatus() {
this.applyButton.active = modified;
}

public void setOptionList(CustomButtonWidget button, OptionList2 optionList) {
public void setOptionList(CustomButtonWidget button, VOptionList optionList) {
this.currentList = optionList;

this.buildPage();
Expand Down
Loading

0 comments on commit dd638f0

Please sign in to comment.