Skip to content

Commit

Permalink
port to 1.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Jan 8, 2024
1 parent a445aa3 commit 978c0df
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ maven_group = com.terraformersmc
archives_base_name = modmenu

# Dependencies
minecraft_version = 1.7.9
feather_build = 25
minecraft_version = 1.7.7-101331
feather_build = 20
nests_build = 1
fabric_loader_version = 0.14.24
quilt_loader_version = 0.19.2
Expand Down
30 changes: 17 additions & 13 deletions src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiElement;
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
import net.minecraft.client.gui.screen.ResultListener;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
Expand All @@ -42,7 +41,7 @@
import java.util.jar.JarFile;
import java.util.stream.Collectors;

public class ModsScreen extends Screen implements ResultListener, Controller {
public class ModsScreen extends Screen implements Controller {
private static final Identifier FILTERS_BUTTON_LOCATION = new Identifier(ModMenu.MOD_ID, "textures/gui/filters_button.png");
private static final Identifier CONFIGURE_BUTTON_LOCATION = new Identifier(ModMenu.MOD_ID, "textures/gui/configure_button.png");

Expand All @@ -55,6 +54,7 @@ public class ModsScreen extends Screen implements ResultListener, Controller {
private static final int LIBRARIES = 6;
private static final int MODS_FOLDER = 7;
private static final int DONE = 8;
public static final int MODS_LIST_CONFIRM_ID_OFFSET = 10;
private static final Text TOGGLE_FILTER_OPTIONS = new TranslatableText("modmenu.toggleFilterOptions");
private static final Text CONFIGURE = new TranslatableText("modmenu.configure");
private static final Logger LOGGER = LogManager.getLogger("Mod Menu | ModsScreen");
Expand Down Expand Up @@ -467,18 +467,22 @@ public Map<String, Boolean> getModHasConfigScreen() {

@Override
public void confirmResult(boolean result, int id) {
super.confirmResult(result, id);
if (result && this.selected != null) {
switch (id) {
case WEBSITE:
ScreenUtil.openLink(this, this.selected.mod.getWebsite(), this.selected.mod.getId() + " /website");
break;
case ISSUES:
ScreenUtil.openLink(this, this.selected.mod.getIssueTracker(), this.selected.mod.getId() + "/issues");
break;
if (id < MODS_LIST_CONFIRM_ID_OFFSET) {
super.confirmResult(result, id);
if (result && this.selected != null) {
switch (id) {
case WEBSITE:
ScreenUtil.openLink(this, this.selected.mod.getWebsite(), this.selected.mod.getId() + " /website");
break;
case ISSUES:
ScreenUtil.openLink(this, this.selected.mod.getIssueTracker(), this.selected.mod.getId() + "/issues");
break;
}
}
}

this.minecraft.openScreen(this);
this.minecraft.openScreen(this);
} else {
this.descriptionListWidget.confirmResult(result, id);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
import net.minecraft.client.gui.screen.CreditsScreen;
import net.minecraft.client.gui.screen.ResultListener;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.client.render.*;
Expand All @@ -29,7 +28,7 @@
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;

public class DescriptionListWidget extends EntryListWidget implements ResultListener {
public class DescriptionListWidget extends EntryListWidget {

private static final Text HAS_UPDATE_TEXT = new TranslatableText("modmenu.hasUpdate");
private static final Text EXPERIMENTAL_TEXT = new TranslatableText("modmenu.experimental").setStyle(new Style().setColor(Formatting.GOLD));
Expand Down Expand Up @@ -376,13 +375,13 @@ public void renderScrollBar(BufferBuilder bufferBuilder) {
}
}

@Override
public void confirmResult(boolean result, int id) {
if (result) {
int index = id - ModsScreen.MODS_LIST_CONFIRM_ID_OFFSET;
List<DescriptionEntry> entries = this.entries;

if (id >= 0 && id < entries.size()) {
DescriptionEntry entry = entries.get(id);
if (index >= 0 && index < entries.size()) {
DescriptionEntry entry = entries.get(index);

if (entry instanceof LinkEntry) {
String link = ((LinkEntry) entry).link;
Expand Down Expand Up @@ -461,7 +460,7 @@ public LinkEntry(String text, String link) {
@Override
public boolean mouseClicked(int index, int mouseX, int mouseY, int button, int entryMouseX, int entryMouseY) {
if (isMouseInList(mouseX, mouseY)) {
minecraft.openScreen(new ConfirmChatLinkScreen(DescriptionListWidget.this, link, index, false));
minecraft.openScreen(new ConfirmChatLinkScreen(DescriptionListWidget.this.parent, link, ModsScreen.MODS_LIST_CONFIRM_ID_OFFSET + index, false));
}
return super.mouseClicked(index, mouseX, mouseY, button, entryMouseX, entryMouseY);
}
Expand Down

0 comments on commit 978c0df

Please sign in to comment.