Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT'
id 'net.fabricmc.fabric-loom' version '1.16-SNAPSHOT'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/3.2/ferry.gradle'
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ org.gradle.parallel=true
maven_group=com.terraformersmc
archive_name=modmenu

minecraft_version=26.1
loader_version=0.18.4
fabric_version=0.144.0+26.1
minecraft_version=26.2-snapshot-2
loader_version=0.18.6
fabric_version=0.145.5+26.2
text_placeholder_api_version=3.0.0-beta.2+26.1
quilt_loader_version=0.29.0-beta.3
quilt_loader_version=0.30.0-beta.7

# Project Metadata
project_name=Mod Menu
project_url=https://modrinth.com/mod/modmenu
project_logo=https://raw.githubusercontent.com/TerraformersMC/ModMenu/refs/heads/26.1/src/main/resources/assets/modmenu/icon_large.png
project_color=0x134bff
# default_release_type can be stable, beta, or alpha
default_release_type=stable
default_release_type=alpha

# Modrinth Metadata
modrinth_slug=modmenu
modrinth_id=mOgUt4GM
modrinth_game_versions=26.1
modrinth_game_versions=26.2-snapshot-2
modrinth_mod_loaders=fabric, quilt
modrinth_required_dependencies=fabric-api, placeholder-api

# CurseForge Metadata
curseforge_slug=modmenu
curseforge_id=308702
curseforge_game_versions=26.1, Fabric, Quilt
curseforge_game_versions=26.2-snapshot, Fabric, Quilt
curseforge_required_dependencies=fabric-api, text-placeholder-api
curseforge_optional_dependencies=

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private static void afterTitleScreenInit(Screen screen) {
MODS_BUTTON_TEXTURE,
32,
64,
button -> Minecraft.getInstance().setScreen(new ModsScreen(screen)),
button -> Minecraft.getInstance().setScreenAndShow(new ModsScreen(screen)),
Comment thread
coredex-source marked this conversation as resolved.
Outdated
ModMenuApi.createModsButtonText()
));
}
Expand All @@ -136,7 +136,7 @@ private static void afterTitleScreenInit(Screen screen) {

private static void onClientEndTick(Minecraft client) {
while (MENU_KEY_MAPPING.consumeClick()) {
client.setScreen(new ModsScreen(client.screen));
client.setScreenAndShow(new ModsScreen(client.gui.screen()));
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected void init() {
AbstractWidget modsFolderButton = Button.builder(ModMenuScreenTexts.MODS_FOLDER, button -> Util.getPlatform().openUri(getModsFolder().toUri())).pos(this.width / 2 - 154, this.height - 28).size(150, 20).build();

// Done button
AbstractWidget doneButton = Button.builder(CommonComponents.GUI_DONE, button -> minecraft.setScreen(previousScreen)).pos(this.width / 2 + 4, this.height - 28).size(150, 20).build();
AbstractWidget doneButton = Button.builder(CommonComponents.GUI_DONE, button -> minecraft.setScreenAndShow(previousScreen)).pos(this.width / 2 + 4, this.height - 28).size(150, 20).build();
Comment thread
coredex-source marked this conversation as resolved.
Outdated

// Initialize data
modList.finalizeInit();
Expand Down Expand Up @@ -500,7 +500,7 @@ private int[] formatModCount(Set<String> set, boolean allVisible) {
@Override
public void onClose() {
this.modList.close();
this.minecraft.setScreen(this.previousScreen);
this.minecraft.setScreenAndShow(this.previousScreen);
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}

private void setFilterOptionsShown(boolean filterOptionsShown) {
Expand Down Expand Up @@ -580,7 +580,7 @@ public void onFilesDrop(List<Path> paths) {

String modList = mods.stream().map(Path::getFileName).map(Path::toString).collect(Collectors.joining(", "));
assert this.minecraft != null;
this.minecraft.setScreen(new ConfirmScreen((value) -> {
this.minecraft.setScreenAndShow(new ConfirmScreen((value) -> {
Comment thread
coredex-source marked this conversation as resolved.
Outdated
if (value) {
boolean allSuccessful = true;
for (Path path : mods) {
Expand All @@ -595,10 +595,10 @@ public void onFilesDrop(List<Path> paths) {
}

if (allSuccessful) {
SystemToast.add(minecraft.getToastManager(), SystemToast.SystemToastId.PERIODIC_NOTIFICATION, ModMenuScreenTexts.DROP_SUCCESSFUL_LINE_1, ModMenuScreenTexts.DROP_SUCCESSFUL_LINE_2);
SystemToast.add(minecraft.gui.toastManager(), SystemToast.SystemToastId.PERIODIC_NOTIFICATION, ModMenuScreenTexts.DROP_SUCCESSFUL_LINE_1, ModMenuScreenTexts.DROP_SUCCESSFUL_LINE_2);
}
}
this.minecraft.setScreen(this);
this.minecraft.setScreenAndShow(this);
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}, ModMenuScreenTexts.DROP_CONFIRM, Component.literal(modList)));
}

Expand Down Expand Up @@ -643,7 +643,7 @@ public void safelyOpenConfigScreen(String modId) {
Screen screen = ModMenu.getConfigScreen(modId, this);
if (screen != null) {
assert this.minecraft != null;
this.minecraft.setScreen(screen);
this.minecraft.setScreenAndShow(screen);
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}
} catch (java.lang.NoClassDefFoundError e) {
LOGGER.warn("The '{}' mod config screen is not available because {} is missing.", modId, e.getLocalizedMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public MojangCreditsEntry(FormattedCharSequence text) {
@Override
public boolean mouseClicked(MouseButtonEvent click, boolean doubleClick) {
if (isMouseOver(click.x(), click.y())) {
minecraft.setScreen(new MinecraftCredits());
minecraft.setScreenAndShow(new MinecraftCredits());
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}

return super.mouseClicked(click, doubleClick);
Expand Down Expand Up @@ -387,11 +387,11 @@ public LinkEntry(FormattedCharSequence text, String link) {
@Override
public boolean mouseClicked(MouseButtonEvent click, boolean doubleClick) {
if (isMouseOver(click.x(), click.y())) {
minecraft.setScreen(new ConfirmLinkScreen((open) -> {
minecraft.setScreenAndShow(new ConfirmLinkScreen((open) -> {
Comment thread
coredex-source marked this conversation as resolved.
Outdated
if (open) {
Util.getPlatform().openUri(link);
}
minecraft.setScreen(parent);
minecraft.setScreenAndShow(parent);
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}, link, false));
}

Expand Down Expand Up @@ -420,11 +420,11 @@ public void extractContent(GuiGraphicsExtractor drawContext, int mouseX, int mou
@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
if (isMouseOver(event.x(), event.y())) {
minecraft.setScreen(new ConfirmLinkScreen((open) -> {
minecraft.setScreenAndShow(new ConfirmLinkScreen((open) -> {
Comment thread
coredex-source marked this conversation as resolved.
Outdated
if (open) {
Util.getPlatform().openUri("mailto:" + email);
}
minecraft.setScreen(parent);
minecraft.setScreenAndShow(parent);
Comment thread
coredex-source marked this conversation as resolved.
Outdated
}, "mailto:" + email, false));
}
return super.mouseClicked(event, doubleClick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ModMenuButtonWidget(int x, int y, int width, int height, net.minecraft.ne
width,
height,
text,
button -> Minecraft.getInstance().setScreen(new ModsScreen(screen)),
button -> Minecraft.getInstance().setScreenAndShow(new ModsScreen(screen)),
Comment thread
coredex-source marked this conversation as resolved.
Outdated
Button.DEFAULT_NARRATION
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void onCreatePauseMenu(CallbackInfo ci) {
ModMenuEventHandler.MODS_BUTTON_TEXTURE,
32,
64,
button -> Minecraft.getInstance().setScreen(new ModsScreen(this)),
button -> Minecraft.getInstance().setScreenAndShow(new ModsScreen(this)),
Comment thread
coredex-source marked this conversation as resolved.
Outdated
ModMenuApi.createModsButtonText()
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static Map<String, Set<Mod>> getModHashes(Collection<Mod> mods) {

public static void triggerV2DeprecatedToast() {
if (modrinthApiV2Deprecated && ModMenuConfig.UPDATE_CHECKER.getValue()) {
Minecraft.getInstance().getToastManager().addToast(new SystemToast(SystemToast.SystemToastId.PERIODIC_NOTIFICATION,
Minecraft.getInstance().gui.toastManager().addToast(new SystemToast(SystemToast.SystemToastId.PERIODIC_NOTIFICATION,
Component.translatable("modmenu.modrinth.v2_deprecated.title"),
Component.translatable("modmenu.modrinth.v2_deprecated.description")
));
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/terraformersmc/modmenu/util/mod/ModSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import com.terraformersmc.modmenu.config.ModMenuConfig;
import com.terraformersmc.modmenu.gui.ModsScreen;

import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;

import net.minecraft.client.resources.language.I18n;
import net.minecraft.util.Tuple;

public class ModSearch {
public static boolean validSearchQuery(String query) {
Expand All @@ -21,12 +22,12 @@ public static List<Mod> search(ModsScreen screen, String query, List<Mod> candid
return candidates;
} else {
return candidates.stream()
.map(modContainer -> new Tuple<>(modContainer,
.map(modContainer -> Map.entry(modContainer,
passesFilters(screen, modContainer, query.toLowerCase(Locale.ROOT))
))
.filter(pair -> pair.getB() > 0)
.sorted((a, b) -> b.getB() - a.getB())
.map(Tuple::getA)
.filter(pair -> pair.getValue() > 0)
.sorted(Comparator.<Map.Entry<Mod, Integer>>comparingInt(Map.Entry::getValue).reversed())
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}
}
Expand Down