Skip to content

Commit

Permalink
Backport to mc1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
NotRyken committed Feb 26, 2025
1 parent 5caf126 commit 9033e67
Show file tree
Hide file tree
Showing 58 changed files with 777 additions and 595 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
build:
strategy:
matrix:
java: [21]
java: [17]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Build
run: ./gradlew build --stacktrace
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }}
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
uses: actions/upload-artifact@v4
with:
name: artifacts
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
release:
strategy:
matrix:
java: [21]
java: [17]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -34,15 +34,15 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
# run: ./gradlew build neoforge:publishGithub fabric:publishGithub --stacktrace
# run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth fabric:publishGithub fabric:publishModrinth --stacktrace
run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth neoforge:publishCurseforge fabric:publishGithub fabric:publishModrinth fabric:publishCurseforge --stacktrace
# run: ./gradlew build forge:publishGithub fabric:publishGithub --stacktrace
# run: ./gradlew build forge:publishGithub forge:publishModrinth fabric:publishGithub fabric:publishModrinth --stacktrace
run: ./gradlew build forge:publishGithub forge:publishModrinth forge:publishCurseforge fabric:publishGithub fabric:publishModrinth fabric:publishCurseforge --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }}
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
uses: actions/upload-artifact@v4
with:
name: artifacts
Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id("fabric-loom") version("${loom_version}") apply(false)
id("net.neoforged.moddev") version("${moddev_version}") apply(false)
id("net.minecraftforge.gradle") version("${forgegradle_version}") apply(false)
id("org.spongepowered.gradle.vanilla") version("${vanillagradle_version}") apply(false)
id("org.spongepowered.mixin") version("${mixingradle_version}") apply(false)
id("org.cadixdev.licenser") version("${licenser_version}") apply(false)
id("me.modmuss50.mod-publish-plugin") version("${mpp_version}")
id("org.ajoberstar.grgit.service") version("${grgitservice_version}")
Expand Down Expand Up @@ -31,7 +33,8 @@ subprojects {

afterEvaluate {
publishMods {
file = project.name == "fabric" ? remapJar.archiveFile : jar.archiveFile
file = project.name == "fabric" ? remapJar.archiveFile : name == "forge"
? project.file("build/libs/${mod_id}-${name}-${mod_version}.jar") : jar.archiveFile
version = mod_version
type = me.modmuss50.mpp.ReleaseType.of(release_type)
displayName = "v${mod_version}-${capsLoader(project.name)}"
Expand Down
23 changes: 7 additions & 16 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,9 @@ repositories {
}
filter { includeGroupAndSubgroups("org.spongepowered") }
}
exclusiveContent {
forRepositories(
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
},
maven {
name = "NeoForge"
url = "https://maven.neoforged.net/releases"
}
)
filter { includeGroup("org.parchmentmc.data") }
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
}
maven {
name = "Modrinth"
Expand Down Expand Up @@ -108,16 +99,16 @@ processResources {
// Java
"java_version": java_version,
"java_versions_fabric_list": asJsonList(java_versions_fabric),
"java_versions_neoforge": java_versions_neoforge,
"java_versions_forge": java_versions_forge,
// Minecraft
"minecraft_versions_fabric_list": asJsonList(minecraft_versions_fabric),
"minecraft_versions_neoforge": minecraft_versions_neoforge,
"minecraft_versions_forge": minecraft_versions_forge,
// Fabric
"fabric_loader_versions_list": asJsonList(fabric_loader_versions),
"fabric_api_versions_list": asJsonList(fabric_api_versions),
// NeoForge
"neoforge_loader_versions": neoforge_loader_versions,
"neoforge_versions": neoforge_versions,
"forge_loader_versions": forge_loader_versions,
"forge_versions": forge_versions,
// Dependencies
"modmenu_versions_fabric_list": asJsonList(modmenu_versions_fabric),
]
Expand Down
19 changes: 9 additions & 10 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
buildscript {
dependencies.add("classpath", "org.spongepowered:vanillagradle:${vanillagradle_version}")
}

plugins {
id("multiloader-common")
id("net.neoforged.moddev")
id("org.spongepowered.gradle.vanilla")
}

dependencies {
Expand All @@ -15,15 +19,10 @@ dependencies {
implementation("maven.modrinth:Wb5oqrBJ:${chatheads_version}")
}

neoForge {
version = neoforge_version // Shut up
neoFormVersion = neoform_version
// Automatically enable AccessTransformers if the file exists
def at = file("src/main/resources/META-INF/accesstransformer.cfg")
if (at.exists()) accessTransformers.from(at.absolutePath)
parchment {
minecraftVersion = parchment_minecraft_version
mappingsVersion = parchment_version
minecraft {
version(minecraft_version)
if (file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void onEndTick(Minecraft mc) {
// Config reset warning toast
if (hasResetConfig && mc.screen instanceof TitleScreen) {
hasResetConfig = false;
mc.getToasts().addToast(new SystemToast(new SystemToast.SystemToastId(15000L),
mc.getToasts().addToast(new SystemToast(SystemToast.SystemToastIds.UNSECURE_SERVER_WARNING,
localized("toast", "reset.title"), localized("toast", "reset.message",
Component.literal(Config.UNREADABLE_FILE_NAME).withStyle(ChatFormatting.GOLD))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ public Config() {

public Notification getUserNotif() {
validateUserNotif();
return notifications.getFirst();
return notifications.get(0);
}

public void setProfileName(String name) {
getUserNotif().triggers.getFirst().string = name;
getUserNotif().triggers.get(0).string = name;
}

public void setDisplayName(String name) {
Expand Down Expand Up @@ -418,7 +418,7 @@ private Config validate() {
notifications.removeIf((n) -> {
n.validate();
return (
n != notifications.getFirst()
n != notifications.get(0)
&& n.triggers.isEmpty()
&& n.exclusionTriggers.isEmpty()
&& n.responseMessages.isEmpty()
Expand All @@ -436,7 +436,7 @@ private void validateUserNotif() {
if (notifications.isEmpty()) {
ChatNotify.LOG.error("Username notification does not exist! Creating...");
notifications.add(Notification.createUser());
} else if (notifications.getFirst().triggers.size() < 2) {
} else if (notifications.get(0).triggers.size() < 2) {
ChatNotify.LOG.error("Username notification missing triggers! Recreating...");
notifications.set(0, Notification.createUser());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ private void addTabs(String defaultKey) {
List<Tab> tabs = List.of(
new Tab(TabKey.TRIGGERS.key, (screen) -> {
Notification notif = cast(screen).notif;
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0,
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
FilterList.Entry.TriggerOptions.class,
(source, dest) -> notif == Config.get().getUserNotif()
? notif.moveTrigger(source + 2, dest + 2)
: notif.moveTrigger(source, dest),
localized("option", "notif.trigger.list", ""),
localized("option", "notif.trigger.list", "\u2139"),
localized("option", "notif.trigger.list.tooltip"),
null,
null,
Expand All @@ -82,7 +82,7 @@ private void addTabs(String defaultKey) {
x, width, height, list, trigger, notif.textStyle, index,
(i) -> notif.triggers.remove((int) i),
new TextField.Validator.UniqueTrigger(
() -> Config.get().getNotifs(),
() -> Config.get().getNotifs(),
(n) -> n.triggers, notif, trigger), true);
}
},
Expand All @@ -94,22 +94,22 @@ private void addTabs(String defaultKey) {
);
}),
new Tab(TabKey.FORMAT.key, (screen) ->
new FormatList(Minecraft.getInstance(), 0, 0, 0,
new FormatList(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
cast(screen).notif
)),
new Tab(TabKey.SOUND.key, (screen) ->
new SoundList(Minecraft.getInstance(), 0, 0, 0,
new SoundList(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT,
cast(screen).notif.sound
)),
new Tab(TabKey.INCLUSION.key, (screen) -> {
Notification notif = cast(screen).notif;
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0,
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
FilterList.Entry.TriggerOptions.class,
notif::moveInclusionTrigger,
localized("option", "notif.inclusion.list", ""),
localized("option", "notif.inclusion.list", "\u2139"),
localized("option", "notif.inclusion.list.tooltip"),
() -> notif.inclusionEnabled,
(status) -> notif.inclusionEnabled = status,
Expand All @@ -128,11 +128,11 @@ private void addTabs(String defaultKey) {
}),
new Tab(TabKey.EXCLUSION.key, (screen) -> {
Notification notif = cast(screen).notif;
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0,
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
FilterList.Entry.TriggerOptions.class,
notif::moveExclusionTrigger,
localized("option", "notif.exclusion.list", ""),
localized("option", "notif.exclusion.list", "\u2139"),
localized("option", "notif.exclusion.list.tooltip"),
() -> notif.exclusionEnabled,
(status) -> notif.exclusionEnabled = status,
Expand All @@ -151,11 +151,11 @@ private void addTabs(String defaultKey) {
}),
new Tab(TabKey.RESPONSES.key, (screen) -> {
Notification notif = cast(screen).notif;
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0,
return new FilterList<>(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
FilterList.Entry.ResponseOptions.class,
notif::moveResponseMessage,
localized("option", "notif.response.list", ""),
localized("option", "notif.response.list", "\u2139"),
localized("option", "notif.response.list.tooltip"),
() -> notif.responseEnabled,
(status) -> notif.responseEnabled = status,
Expand All @@ -169,7 +169,7 @@ private void addTabs(String defaultKey) {
);
}),
new Tab(TabKey.MISC.key, (screen) ->
new MiscOptionList(Minecraft.getInstance(), 0, 0, 0,
new MiscOptionList(Minecraft.getInstance(), 0, 0, 0, 0,
BASE_LIST_ENTRY_WIDTH, LIST_ENTRY_HEIGHT, LIST_ENTRY_SPACING,
cast(screen).notif
))
Expand Down
Loading

0 comments on commit 9033e67

Please sign in to comment.