Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
peterix authored Dec 22, 2024
2 parents 6f2b4be + af21626 commit f8cf41f
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 73 deletions.
18 changes: 10 additions & 8 deletions apps/discord-cat/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static_text_command! {
"https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java";
too_much_ram "tmram" "vazkiiram",
"Allocating too much RAM to Minecraft is bad for performance:",
"https://vazkii.net/blog_archive/#blog/ram-explanation";
"https://vazkii.notion.site/A-semi-technical-explanation-of-why-you-shouldn-t-allocate-too-much-RAM-to-Minecraft-78e7bd41ba6646de8d1c55c033674bce";
mod_repost "repost" "vazkiirepost" "9mc" "9minecraft",
"Please make sure you only download mods from reputable sources.",
"For more info, please read https://vazkii.net/repost/";
Expand Down Expand Up @@ -114,18 +114,20 @@ static_text_command! {

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

}

#[group]
Expand Down
Binary file added apps/discord-cat/src/images/install_forge.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/discord-cat/src/images/jvm_args.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/discord-cat/src/images/set_java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/discord-cat/src/images/set_ram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/discord-cat/src/images/upload_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/discord-cat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl EventHandler for Handler {
}

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

if let Some(link) = PASTEE_REGEX.find(&msg.content) {
Expand Down
96 changes: 33 additions & 63 deletions libs/background-cat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ pub fn common_mistakes(input: &str) -> Vec<(&str, String)> {

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

pub(crate) const PARSERS: [Check; 16] = [
pub(crate) const PARSERS: [Check; 18] = [
multimc_in_program_files,
macos_too_new_java,
multimc_in_onedrive_managed_folder,
//major_java_version,
forge_too_new_java,
one_seventeen_plus_java_too_old,
two_one_plus_java_too_old,
m1_failed_to_find_service_port,
pixel_format_not_accelerated_win10,
intel_graphics_icd_dll,
Expand All @@ -27,9 +27,9 @@ pub(crate) const PARSERS: [Check; 16] = [
shadermod_optifine_conflict,
fabric_api_missing,
java_architecture,
detect_temp_directories,
using_system_glfw,
using_system_openal,
//old_multimc_version,
reboot_required,
];

Expand Down Expand Up @@ -101,26 +101,6 @@ fn multimc_in_onedrive_managed_folder(log: &str) -> Option<(&str, String)> {
None
}
}
/*
fn major_java_version(log: &str) -> Option<(&str, String)> {
lazy_static! {
static ref RE: Regex =
Regex::new(r"Java is version (1.)??(?P<ver>[6-9]|[1-9][0-9])+(\..+)??,").unwrap();
}
match RE.captures(log) {
Some(capture) if capture.name("ver")?.as_str() == "8" => None,
Some(capture) => Some((
"❗",
format!(
"You're using Java {}. Versions other than Java 8 are not designed to be used with Minecraft and may cause issues. \
[See here for help installing the correct version.](https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java)",
capture.name("ver")?.as_str()
),
)),
_ => None,
}
}
*/

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

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

if log.contains(UNSUPPORTED_CLASS_VERSION_ERROR)
|| log.contains(FABRIC_JAVA_VERSION_ERROR)
if log.contains(FABRIC_JAVA_VERSION_ERROR)
|| log.contains(FABRIC_JAVA_VERSION_ERROR_SEVENTEEN)
|| log.contains(JAVA_16_WARNING)
|| log.contains(JAVA_17_WARNING)
{
Some(("‼", RESPONSES.get("use-java-17")?.to_string()))
Expand All @@ -148,6 +128,18 @@ fn one_seventeen_plus_java_too_old(log: &str) -> Option<(&str, String)> {
}
}

fn two_one_plus_java_too_old(log: &str) -> Option<(&str, String)> {
const JAVA_CHECK_CLASS_FILE_VERSION: &str = "(class file version 65.0)";
const JAVA_CHECK_CLASS_FILE_VERSION_MMC: &str = "Minecraft 24w14a and above require the use of Java 21";
if log.contains(JAVA_CHECK_CLASS_FILE_VERSION)
|| log.contains(JAVA_CHECK_CLASS_FILE_VERSION_MMC)
{
Some(("‼", RESPONSES.get("use-java-21")?.to_string()))
} else {
None
}
}

fn m1_failed_to_find_service_port(log: &str) -> Option<(&str, String)> {
const TRIGGER: &str = "java.lang.IllegalStateException: GLFW error before init: [0x10008]Cocoa: Failed to find service port for display";
if log.contains(TRIGGER) {
Expand Down Expand Up @@ -193,6 +185,21 @@ fn java_architecture(log: &str) -> Option<(&str, String)> {
}
}

fn detect_temp_directories(log: &str) -> Option<(&str, String)> {
lazy_static! {
static ref RE: Regex = Regex::new(r"Minecraft folder is:\n[A-Z]:/([^/]+/)*Temp").unwrap();
}
if log.contains("Rar$") {
Some(("‼", RESPONSES.get("winrar-temp")?.to_string()))
}
else if RE.is_match(log) && !log.contains("forge_installer") {
Some(("‼", RESPONSES.get("temp-folder")?.to_string()))
}
else {
None
}
}

fn using_system_openal(log: &str) -> Option<(&str, String)> {
const TRIGGER: &str = "Using system OpenAL.";
if log.contains(TRIGGER) {
Expand All @@ -210,43 +217,6 @@ fn using_system_glfw(log: &str) -> Option<(&str, String)> {
None
}
}
/* Regex is incorrect/
fn old_multimc_version(log: &str) -> Option<(&str, String)> {
lazy_static! {
static ref RE: Regex =
Regex::new(r"MultiMC version: (?P<major_ver>0\.[0-9]+\.[0-9]+-(?P<build>[0-9]+))\n")
.unwrap();
}
if let Some(capture) = RE.captures(log) {
match capture.name("build")?.as_str().parse::<u32>() {
Ok(o) => {
if o < 900 {
Some((
"❗",
format!(
"You seem to be using an old build of MultiMC ({}). \
Please update to a more recent version.",
capture.name("major_ver")?.as_str()
),
))
} else {
None
}
}
Err(_) => Some((
"❗",
format!(
"You seem to be using an unofficial version of MultiMC ({}). \
Please only use MultiMC downloaded from [multimc.org](https://multimc.org/#Download).",
capture.name("major_ver")?.as_str()
),
)),
}
} else {
None
}
}
*/

fn reboot_required(log: &str) -> Option<(&str, String)> {
const TRIGGER: &str = "Couldn't extract native jar";
Expand Down
23 changes: 22 additions & 1 deletion libs/background-cat/src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lazy_static! {
"out-of-memory",
indoc! {
"You've run out of memory. You should allocate more, although the exact value depends on how many mods you have installed. \
[Click this link for a guide.](https://cdn.discordapp.com/attachments/531598137790562305/575376840173027330/unknown.png)"
[Click this link for a guide.](https://raw.githubusercontent.com/MultiMC/background-cat/master/apps/discord-cat/src/images/set_ram.png)"
}
),
(
Expand Down Expand Up @@ -66,6 +66,13 @@ lazy_static! {
[Please check our wiki for more information.](https://github.com/MultiMC/Launcher/wiki/Using-the-right-Java#minecraft-117-and-newer)"
}
),
(
"use-java-21",
indoc! {
"You are playing a version of Minecraft that requires Java 21 or newer, but are using an older Java version.\n\
[Please check our wiki for more information.](https://github.com/MultiMC/Launcher/wiki/Using-the-right-Java#minecraft-210-and-newer)"
}
),
(
"apple-silicon-incompatible-forge",
indoc! {
Expand All @@ -85,6 +92,20 @@ lazy_static! {
"You're using 32-bit Java. [See here for help installing the correct version.](https://github.com/MultiMC/MultiMC5/wiki/Using-the-right-Java)"
}
),
(
"temp-folder",
indoc! {"
Your MultiMC installation is in a temporary folder. Your operating system will remove it.\n\
To prevent data loss, you should move it or extract it somewhere else, like the C: top directory."
}
),
(
"winrar-temp",
indoc! {"
You did not extract MultiMC to a real folder and are running it from WinRar. Windows will remove it.\n\
To prevent data loss, you should extract it somewhere, like the C: top directory."
}
),
(
"custom-build",
indoc! {
Expand Down

0 comments on commit f8cf41f

Please sign in to comment.