Skip to content

Commit f8cf41f

Browse files
authored
Merge branch 'master' into master
2 parents 6f2b4be + af21626 commit f8cf41f

File tree

10 files changed

+66
-73
lines changed

10 files changed

+66
-73
lines changed

apps/discord-cat/src/commands/mod.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static_text_command! {
8181
"https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java";
8282
too_much_ram "tmram" "vazkiiram",
8383
"Allocating too much RAM to Minecraft is bad for performance:",
84-
"https://vazkii.net/blog_archive/#blog/ram-explanation";
84+
"https://vazkii.notion.site/A-semi-technical-explanation-of-why-you-shouldn-t-allocate-too-much-RAM-to-Minecraft-78e7bd41ba6646de8d1c55c033674bce";
8585
mod_repost "repost" "vazkiirepost" "9mc" "9minecraft",
8686
"Please make sure you only download mods from reputable sources.",
8787
"For more info, please read https://vazkii.net/repost/";
@@ -114,18 +114,20 @@ static_text_command! {
114114

115115
// Format: Name (Optional Alias1 Alias2...) , Image Link (, Optional Message) ;
116116
static_image_command! {
117-
upload_log "log", "https://cdn.discordapp.com/attachments/531598137790562305/575381000398569493/unknown.png",
117+
upload_log "log", "https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/upload_log.png",
118118
"Please upload your log:";
119-
select_java "sjava", "https://cdn.discordapp.com/attachments/531598137790562305/575378380573114378/unknown.png",
119+
select_java "sjava", "https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/set_java.png",
120120
"Please select your Java version in the MultiMC settings:";
121-
select_memory "smemory" "sram", "https://cdn.discordapp.com/attachments/531598137790562305/575376840173027330/unknown.png",
121+
select_memory "smemory" "sram", "https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/set_ram.png",
122122
"Please set your instance memory allocation:";
123-
install_forge "iforge", "https://cdn.discordapp.com/attachments/531598137790562305/575385471207866388/Install_Forge_in_MultiMC.gif",
123+
install_forge "iforge", "https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/install_forge.gif",
124124
"How to install Forge:";
125125
javaarg "javaargs" "jarg" "jargs",
126-
"https://cdn.discordapp.com/attachments/362205883218001920/711410345301770300/MultiMC_JVM_Args.png";
127-
multimc_dev "dev", "https://cdn.discordapp.com/attachments/134843027553255425/855880510031003728/unknown.png",
128-
"How to switch to the MultiMC development version:";
126+
"https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/jvm_args.png";
127+
select_java_instance "instjava",
128+
"https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/java-instance-select.jpg",
129+
"Please select the right java for your current instance:";
130+
129131
}
130132

131133
#[group]
890 KB
Loading
Loading
61.6 KB
Loading
90.9 KB
Loading
71.6 KB
Loading
97.9 KB
Loading

apps/discord-cat/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl EventHandler for Handler {
102102
}
103103

104104
lazy_static! {
105-
static ref PASTEE_REGEX: Regex = Regex::new(r"https:/{2}paste.ee/p/[^\s/]+").unwrap();
105+
static ref PASTEE_REGEX: Regex = Regex::new(r"https:/{2}(?:api\.)?paste\.ee/p/[^\s/]+").unwrap();
106106
}
107107

108108
if let Some(link) = PASTEE_REGEX.find(&msg.content) {

libs/background-cat/src/lib.rs

+33-63
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ pub fn common_mistakes(input: &str) -> Vec<(&str, String)> {
1212

1313
pub(crate) type Check = fn(&str) -> Option<(&str, String)>;
1414

15-
pub(crate) const PARSERS: [Check; 16] = [
15+
pub(crate) const PARSERS: [Check; 18] = [
1616
multimc_in_program_files,
1717
macos_too_new_java,
1818
multimc_in_onedrive_managed_folder,
19-
//major_java_version,
2019
forge_too_new_java,
2120
one_seventeen_plus_java_too_old,
21+
two_one_plus_java_too_old,
2222
m1_failed_to_find_service_port,
2323
pixel_format_not_accelerated_win10,
2424
intel_graphics_icd_dll,
@@ -27,9 +27,9 @@ pub(crate) const PARSERS: [Check; 16] = [
2727
shadermod_optifine_conflict,
2828
fabric_api_missing,
2929
java_architecture,
30+
detect_temp_directories,
3031
using_system_glfw,
3132
using_system_openal,
32-
//old_multimc_version,
3333
reboot_required,
3434
];
3535

@@ -101,26 +101,6 @@ fn multimc_in_onedrive_managed_folder(log: &str) -> Option<(&str, String)> {
101101
None
102102
}
103103
}
104-
/*
105-
fn major_java_version(log: &str) -> Option<(&str, String)> {
106-
lazy_static! {
107-
static ref RE: Regex =
108-
Regex::new(r"Java is version (1.)??(?P<ver>[6-9]|[1-9][0-9])+(\..+)??,").unwrap();
109-
}
110-
match RE.captures(log) {
111-
Some(capture) if capture.name("ver")?.as_str() == "8" => None,
112-
Some(capture) => Some((
113-
"❗",
114-
format!(
115-
"You're using Java {}. Versions other than Java 8 are not designed to be used with Minecraft and may cause issues. \
116-
[See here for help installing the correct version.](https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java)",
117-
capture.name("ver")?.as_str()
118-
),
119-
)),
120-
_ => None,
121-
}
122-
}
123-
*/
124104

125105
fn forge_too_new_java(log: &str) -> Option<(&str, String)> {
126106
const URLCLASSLOADER_CAST: &str = "java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader";
@@ -132,14 +112,14 @@ fn forge_too_new_java(log: &str) -> Option<(&str, String)> {
132112
}
133113

134114
fn one_seventeen_plus_java_too_old(log: &str) -> Option<(&str, String)> {
135-
const UNSUPPORTED_CLASS_VERSION_ERROR: &str = "java.lang.UnsupportedClassVersionError: net/minecraft/client/main/Main";
136115
const FABRIC_JAVA_VERSION_ERROR: &str = "fabric requires {java @ [>=16]}";
137116
const FABRIC_JAVA_VERSION_ERROR_SEVENTEEN: &str = "fabric requires {java @ [>=17]}";
117+
const JAVA_16_WARNING: &str = "Minecraft 21w19a and above require the use of Java 16";
138118
const JAVA_17_WARNING: &str = "Minecraft 1.18 Pre Release 2 and above require the use of Java 17";
139119

140-
if log.contains(UNSUPPORTED_CLASS_VERSION_ERROR)
141-
|| log.contains(FABRIC_JAVA_VERSION_ERROR)
120+
if log.contains(FABRIC_JAVA_VERSION_ERROR)
142121
|| log.contains(FABRIC_JAVA_VERSION_ERROR_SEVENTEEN)
122+
|| log.contains(JAVA_16_WARNING)
143123
|| log.contains(JAVA_17_WARNING)
144124
{
145125
Some(("‼", RESPONSES.get("use-java-17")?.to_string()))
@@ -148,6 +128,18 @@ fn one_seventeen_plus_java_too_old(log: &str) -> Option<(&str, String)> {
148128
}
149129
}
150130

131+
fn two_one_plus_java_too_old(log: &str) -> Option<(&str, String)> {
132+
const JAVA_CHECK_CLASS_FILE_VERSION: &str = "(class file version 65.0)";
133+
const JAVA_CHECK_CLASS_FILE_VERSION_MMC: &str = "Minecraft 24w14a and above require the use of Java 21";
134+
if log.contains(JAVA_CHECK_CLASS_FILE_VERSION)
135+
|| log.contains(JAVA_CHECK_CLASS_FILE_VERSION_MMC)
136+
{
137+
Some(("‼", RESPONSES.get("use-java-21")?.to_string()))
138+
} else {
139+
None
140+
}
141+
}
142+
151143
fn m1_failed_to_find_service_port(log: &str) -> Option<(&str, String)> {
152144
const TRIGGER: &str = "java.lang.IllegalStateException: GLFW error before init: [0x10008]Cocoa: Failed to find service port for display";
153145
if log.contains(TRIGGER) {
@@ -193,6 +185,21 @@ fn java_architecture(log: &str) -> Option<(&str, String)> {
193185
}
194186
}
195187

188+
fn detect_temp_directories(log: &str) -> Option<(&str, String)> {
189+
lazy_static! {
190+
static ref RE: Regex = Regex::new(r"Minecraft folder is:\n[A-Z]:/([^/]+/)*Temp").unwrap();
191+
}
192+
if log.contains("Rar$") {
193+
Some(("‼", RESPONSES.get("winrar-temp")?.to_string()))
194+
}
195+
else if RE.is_match(log) && !log.contains("forge_installer") {
196+
Some(("‼", RESPONSES.get("temp-folder")?.to_string()))
197+
}
198+
else {
199+
None
200+
}
201+
}
202+
196203
fn using_system_openal(log: &str) -> Option<(&str, String)> {
197204
const TRIGGER: &str = "Using system OpenAL.";
198205
if log.contains(TRIGGER) {
@@ -210,43 +217,6 @@ fn using_system_glfw(log: &str) -> Option<(&str, String)> {
210217
None
211218
}
212219
}
213-
/* Regex is incorrect/
214-
fn old_multimc_version(log: &str) -> Option<(&str, String)> {
215-
lazy_static! {
216-
static ref RE: Regex =
217-
Regex::new(r"MultiMC version: (?P<major_ver>0\.[0-9]+\.[0-9]+-(?P<build>[0-9]+))\n")
218-
.unwrap();
219-
}
220-
if let Some(capture) = RE.captures(log) {
221-
match capture.name("build")?.as_str().parse::<u32>() {
222-
Ok(o) => {
223-
if o < 900 {
224-
Some((
225-
"❗",
226-
format!(
227-
"You seem to be using an old build of MultiMC ({}). \
228-
Please update to a more recent version.",
229-
capture.name("major_ver")?.as_str()
230-
),
231-
))
232-
} else {
233-
None
234-
}
235-
}
236-
Err(_) => Some((
237-
"❗",
238-
format!(
239-
"You seem to be using an unofficial version of MultiMC ({}). \
240-
Please only use MultiMC downloaded from [multimc.org](https://multimc.org/#Download).",
241-
capture.name("major_ver")?.as_str()
242-
),
243-
)),
244-
}
245-
} else {
246-
None
247-
}
248-
}
249-
*/
250220

251221
fn reboot_required(log: &str) -> Option<(&str, String)> {
252222
const TRIGGER: &str = "Couldn't extract native jar";

libs/background-cat/src/responses.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ lazy_static! {
2727
"out-of-memory",
2828
indoc! {
2929
"You've run out of memory. You should allocate more, although the exact value depends on how many mods you have installed. \
30-
[Click this link for a guide.](https://cdn.discordapp.com/attachments/531598137790562305/575376840173027330/unknown.png)"
30+
[Click this link for a guide.](https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/set_ram.png)"
3131
}
3232
),
3333
(
@@ -66,6 +66,13 @@ lazy_static! {
6666
[Please check our wiki for more information.](https://github.com/MultiMC/Launcher/wiki/Using-the-right-Java#minecraft-117-and-newer)"
6767
}
6868
),
69+
(
70+
"use-java-21",
71+
indoc! {
72+
"You are playing a version of Minecraft that requires Java 21 or newer, but are using an older Java version.\n\
73+
[Please check our wiki for more information.](https://github.com/MultiMC/Launcher/wiki/Using-the-right-Java#minecraft-210-and-newer)"
74+
}
75+
),
6976
(
7077
"apple-silicon-incompatible-forge",
7178
indoc! {
@@ -85,6 +92,20 @@ lazy_static! {
8592
"You're using 32-bit Java. [See here for help installing the correct version.](https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java)"
8693
}
8794
),
95+
(
96+
"temp-folder",
97+
indoc! {"
98+
Your MultiMC installation is in a temporary folder. Your operating system will remove it.\n\
99+
To prevent data loss, you should move it or extract it somewhere else, like the C: top directory."
100+
}
101+
),
102+
(
103+
"winrar-temp",
104+
indoc! {"
105+
You did not extract MultiMC to a real folder and are running it from WinRar. Windows will remove it.\n\
106+
To prevent data loss, you should extract it somewhere, like the C: top directory."
107+
}
108+
),
88109
(
89110
"custom-build",
90111
indoc! {

0 commit comments

Comments
 (0)