1+ /*
2+ * This file is part of OneConfig.
3+ * OneConfig - Next Generation Config Library for Minecraft: Java Edition
4+ * Copyright (C) 2021~2024 Polyfrost.
5+ * <https://polyfrost.org> <https://github.com/Polyfrost/>
6+ *
7+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8+ *
9+ * OneConfig is licensed under the terms of version 3 of the GNU Lesser
10+ * General Public License as published by the Free Software Foundation, AND
11+ * under the Additional Terms Applicable to OneConfig, as published by Polyfrost,
12+ * either version 1.0 of the Additional Terms, or (at your option) any later
13+ * version.
14+ *
15+ * This program is distributed in the hope that it will be useful,
16+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+ * Lesser General Public License for more details.
19+ *
20+ * You should have received a copy of the GNU Lesser General Public
21+ * License. If not, see <https://www.gnu.org/licenses/>. You should
22+ * have also received a copy of the Additional Terms Applicable
23+ * to OneConfig, as published by Polyfrost. If not, see
24+ * <https://polyfrost.org/legal/oneconfig/additional-terms>
25+ */
26+
27+ //#if FORGE && MC<=11202
28+ package org .polyfrost .oneconfig .internal .mixin .forge ;
29+
30+ import com .llamalad7 .mixinextras .injector .v2 .WrapWithCondition ;
31+ import net .minecraftforge .fml .common .LoaderException ;
32+ import net .minecraftforge .fml .common .discovery .JarDiscoverer ;
33+ import org .apache .logging .log4j .Level ;
34+ import org .spongepowered .asm .mixin .Mixin ;
35+ import org .spongepowered .asm .mixin .injection .At ;
36+
37+ @ Mixin (value = JarDiscoverer .class , remap = false )
38+ public class JarDiscovererMixin {
39+
40+ @ WrapWithCondition (method =
41+ //#if MC<=10809
42+ "discover"
43+ //#else
44+ //$$ "findClassesASM"
45+ //#endif
46+ , at = @ At (value = "INVOKE" , target = "Lnet/minecraftforge/fml/common/FMLLog;log(Lorg/apache/logging/log4j/Level;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V" ))
47+ private boolean ignoreException (Level level , Throwable ex , String format , Object [] data ) {
48+ if (ex instanceof LoaderException ) {
49+ return !(ex .getCause () instanceof IllegalArgumentException );
50+ }
51+ return true ;
52+ }
53+ }
54+ //#endif
0 commit comments