Skip to content

Commit

Permalink
Variable renames in the Iris GUI package
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbot16 committed Sep 12, 2021
1 parent 6b7891d commit c57b4f7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.ObjectSelectionList;

public class IrisScreenEntryListWidget<E extends ObjectSelectionList.Entry<E>> extends ObjectSelectionList<E> {
public IrisScreenEntryListWidget(Minecraft client, int width, int height, int top, int bottom, int left, int right, int itemHeight) {
public class IrisObjectSelectionList<E extends ObjectSelectionList.Entry<E>> extends ObjectSelectionList<E> {
public IrisObjectSelectionList(Minecraft client, int width, int height, int top, int bottom, int left, int right, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);

this.x0 = left;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;
import java.util.stream.Collectors;

public class ShaderPackListWidget extends IrisScreenEntryListWidget<ShaderPackListWidget.BaseEntry> {
public class ShaderPackSelectionList extends IrisObjectSelectionList<ShaderPackSelectionList.BaseEntry> {
public static final List<String> BUILTIN_PACKS = ImmutableList.of();

private static final Component PACK_LIST_LABEL = new TranslatableComponent("pack.iris.list.label").withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY);
Expand All @@ -27,7 +27,7 @@ public class ShaderPackListWidget extends IrisScreenEntryListWidget<ShaderPackLi

private final EnableShadersButtonEntry enableShadersButton = new EnableShadersButtonEntry(Iris.getIrisConfig().areShadersEnabled());

public ShaderPackListWidget(Minecraft client, int width, int height, int top, int bottom, int left, int right) {
public ShaderPackSelectionList(Minecraft client, int width, int height, int top, int bottom, int left, int right) {
super(client, width, height, top, bottom, left, right, 20);

refresh();
Expand Down Expand Up @@ -114,10 +114,10 @@ protected BaseEntry() {}

public static class ShaderPackEntry extends BaseEntry {
private final String packName;
private final ShaderPackListWidget list;
private final ShaderPackSelectionList list;
private final int index;

public ShaderPackEntry(int index, ShaderPackListWidget list, String packName) {
public ShaderPackEntry(int index, ShaderPackSelectionList list, String packName) {
this.packName = packName;
this.list = list;
this.index = index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ShadowDistanceOption(String string, double d, double e, float f, Function

@Override
public AbstractWidget createButton(Options options, int x, int y, int width) {
AbstractWidget widget = new ShadowDistanceSliderWidget(options, x, y, width, 20, this);
AbstractWidget widget = new ShadowDistanceSliderButton(options, x, y, width, 20, this);

widget.active = IrisVideoSettings.isShadowDistanceSliderEnabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import net.minecraft.client.ProgressOption;
import net.minecraft.client.gui.components.SliderButton;

public class ShadowDistanceSliderWidget extends SliderButton {
public ShadowDistanceSliderWidget(Options gameOptions, int x, int y, int width, int height, ProgressOption option) {
public class ShadowDistanceSliderButton extends SliderButton {
public ShadowDistanceSliderButton(Options gameOptions, int x, int y, int width, int height, ProgressOption option) {
super(gameOptions, x, y, width, height, option);
}

Expand Down
14 changes: 6 additions & 8 deletions src/main/java/net/coderbot/iris/gui/screen/ShaderPackScreen.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package net.coderbot.iris.gui.screen;

import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.element.ShaderPackListWidget;
import net.coderbot.iris.gui.element.ShaderPackSelectionList;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import org.apache.commons.io.FileUtils;
import com.mojang.blaze3d.vertex.PoseStack;
import java.io.IOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -24,7 +22,7 @@ public class ShaderPackScreen extends Screen implements HudHideable {

private final Screen parent;

private ShaderPackListWidget shaderPackList;
private ShaderPackSelectionList shaderPackList;

private Component addedPackDialog = null;
private int addedPackDialogTimer = 0;
Expand Down Expand Up @@ -65,7 +63,7 @@ protected void init() {
int topCenter = this.width / 2 - 76;
boolean inWorld = this.minecraft.level != null;

this.shaderPackList = new ShaderPackListWidget(this.minecraft, this.width, this.height, 32, this.height - 58, 0, this.width);
this.shaderPackList = new ShaderPackSelectionList(this.minecraft, this.width, this.height, 32, this.height - 58, 0, this.width);

if (inWorld) {
this.shaderPackList.setRenderBackground(false);
Expand Down Expand Up @@ -229,13 +227,13 @@ private void dropChangesAndClose() {
}

private void applyChanges() {
ShaderPackListWidget.BaseEntry base = this.shaderPackList.getSelected();
ShaderPackSelectionList.BaseEntry base = this.shaderPackList.getSelected();

if (!(base instanceof ShaderPackListWidget.ShaderPackEntry)) {
if (!(base instanceof ShaderPackSelectionList.ShaderPackEntry)) {
return;
}

ShaderPackListWidget.ShaderPackEntry entry = (ShaderPackListWidget.ShaderPackEntry)base;
ShaderPackSelectionList.ShaderPackEntry entry = (ShaderPackSelectionList.ShaderPackEntry)base;
String name = entry.getPackName();
Iris.getIrisConfig().setShaderPackName(name);
Iris.getIrisConfig().setShadersEnabled(this.shaderPackList.getEnableShadersButton().enabled);
Expand Down

0 comments on commit c57b4f7

Please sign in to comment.