Skip to content

Commit

Permalink
Port to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lab3 committed May 26, 2023
1 parent e4f12c6 commit fa178bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'maven-publish'

version = '1.0.2'
version = '1.18.2-1.0.2'
group = 'io.redspace.modlist'
archivesBaseName = 'modlist'

Expand All @@ -25,7 +25,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"

minecraft {
mappings channel: 'parchment', version: "2022.11.27-1.19.2"
mappings channel: 'parchment', version: "2022.11.06-1.18.2"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
Expand Down Expand Up @@ -100,7 +100,7 @@ repositories {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.2.3'
minecraft 'net.minecraftforge:forge:1.18.2-40.2.0'
}

// Example for how to get properties into the manifest for reading at runtime.
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/io/redspace/modlist/command/GenerateModList.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraftforge.fml.ModList;

import java.io.BufferedWriter;
Expand All @@ -17,7 +19,7 @@

public class GenerateModList {

private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.modlist.generate_mod_list.failed"));
private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(new TranslatableComponent("commands.modlist.generate_mod_list.failed"));

public static void register(CommandDispatcher<CommandSourceStack> pDispatcher) {
pDispatcher.register(Commands.literal("modlist").requires((p_138819_) -> {
Expand Down Expand Up @@ -54,7 +56,7 @@ private static int generateModList(CommandSourceStack source) throws CommandSynt
sb.append(",");
sb.append(iModInfo.getOwningFile().getFile().getFileName());
sb.append(",");
iModInfo.getModURL().ifPresent(sb::append);
//Not available in 1.18.2 iModInfo.getModURL().ifPresent(sb::append);
sb.append(",");
iModInfo.getConfig().getConfigElement("displayURL").ifPresent(sb::append);
sb.append(",");
Expand All @@ -68,11 +70,11 @@ private static int generateModList(CommandSourceStack source) throws CommandSynt
writer.write(sb.toString());
writer.close();

Component component = Component.literal(file.getName()).withStyle(ChatFormatting.UNDERLINE).withStyle((style) -> {
Component component = new TextComponent(file.getName()).withStyle(ChatFormatting.UNDERLINE).withStyle((style) -> {
return style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file.getAbsolutePath()));
});

source.sendSuccess(Component.translatable("commands.modlist.generate_mod_list.success", component), true);
source.sendSuccess(new TranslatableComponent("commands.modlist.generate_mod_list.success", component), true);

} catch (Exception e) {
Modlist.LOGGER.info(e.getMessage());
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ displayName="Modlist" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
displayURL="https://www.curseforge.com/minecraft/mc-mods/modlist" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="modlist.png" #optional
# A text field displayed in the mod UI
Expand All @@ -34,7 +34,7 @@ credits="" #optional
authors="Iron431, Lab3" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
Adds a modlist command to the game to help with issue reporting'''
Adds a /modlist command to the game that helps when reporting issues or sharing the details of a modpack.'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.modlist]] #optional
# the modid of the dependency
Expand All @@ -47,10 +47,10 @@ Adds a modlist command to the game to help with issue reporting'''
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"
[[dependencies.irons_spellbooks]]
[[dependencies.modlist]]
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.19.2,1.19.3)"
versionRange="[1.18.2,1.18.3)"
ordering="NONE"
side="BOTH"

0 comments on commit fa178bd

Please sign in to comment.