mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-20 15:49:36 +00:00
Fix checkstyle violations
This commit is contained in:
1 parent
7317ae474f
commit
444feb414e
3 files changed
+42
-12
No files matched your search
+6
-2
@@ -208,6 +208,7 @@ public class MixinPlatformAgentFMLLegacy extends MixinPlatformAgentAbstract impl
|
||||
* <p>Reparseable coremods are excluded from being crawled for regular mods
|
||||
* during <i>class path</i> mod discovery, so we must not add mods on the
|
||||
* boot class path to this list.</p>
|
||||
*
|
||||
* <p>The reason we use the <i>boot</i> class path is because coremods in
|
||||
* the mods directory have been injected into the class path at this point,
|
||||
* and we <i>do</i> want to mark those as reparseable, so they don't get
|
||||
@@ -434,8 +435,11 @@ public class MixinPlatformAgentFMLLegacy extends MixinPlatformAgentAbstract impl
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Called after Mixin configs have been loaded. Do Forge-specific initialization.</p>
|
||||
* <p>Note: The mod bootstrapping Mixin must contain an FML plugin for this to get called.</p>
|
||||
* <p>Called after Mixin configs have been loaded. Do Forge-specific
|
||||
* initialization.</p>
|
||||
*
|
||||
* <p>Note: The mod bootstrapping Mixin must contain an FML plugin for this
|
||||
* to get called.</p>
|
||||
*/
|
||||
@Override
|
||||
public void initPrimaryContainer() {
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* This file is part of Mixin, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) SpongePowered <https://www.spongepowered.org>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package org.spongepowered.asm.mixin;
|
||||
|
||||
// Reference: https://github.com/FabricMC/fabric-loader/blob/2a378f1c563b6ec96ae6620a278ecd23fa09da0f/src/main/java/net/fabricmc/loader/impl/launch/FabricMixinBootstrap.java
|
||||
@@ -13,22 +37,24 @@ import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
public class ForgeUtils {
|
||||
public final class ForgeUtils {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
public static final String KEY_MOD_ID = "fabric-modId";
|
||||
|
||||
private ForgeUtils() {}
|
||||
|
||||
public static void init() {
|
||||
Map<String, String> jarNameToModid = createJarNameToModidMap();
|
||||
|
||||
for(Config config : Mixins.getConfigs()) {
|
||||
for (Config config : Mixins.getConfigs()) {
|
||||
URL resource = Launch.classLoader.getResource(config.getName());
|
||||
if(resource != null) {
|
||||
if (resource != null) {
|
||||
String jarName = getJarNameFromResourceUrl(resource);
|
||||
if(jarName != null) {
|
||||
if (jarName != null) {
|
||||
String modid = jarNameToModid.get(jarName);
|
||||
if(modid != null) {
|
||||
if (modid != null) {
|
||||
config.getConfig().decorate(KEY_MOD_ID, modid);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +77,7 @@ public class ForgeUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to construct jar name -> modid map, mod names will not be shown in errors.");
|
||||
}
|
||||
return map;
|
||||
@@ -65,17 +91,17 @@ public class ForgeUtils {
|
||||
} else {
|
||||
return Arrays.asList(new Gson().fromJson(new InputStreamReader(url.openStream()), ModMetadata.class));
|
||||
}
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to parse mcmod.info at " + url + ": " + e);
|
||||
}
|
||||
return Arrays.asList();
|
||||
}
|
||||
|
||||
private static String getJarNameFromResourceUrl(URL url) {
|
||||
if(url.getPath().contains("!/")) {
|
||||
if (url.getPath().contains("!/")) {
|
||||
String filePath = url.getPath().split("!/")[0];
|
||||
String[] parts = filePath.split("/");
|
||||
if(parts.length != 0) {
|
||||
if (parts.length != 0) {
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class FMLLegacyDevRemapper implements IRemapper {
|
||||
@Override
|
||||
public String mapDesc(String desc) {
|
||||
String remapped = descCache.get(desc);
|
||||
if(remapped == null) {
|
||||
if (remapped == null) {
|
||||
remapped = desc;
|
||||
for (Entry<String, String> entry : this.mappings.entrySet()) {
|
||||
remapped = remapped.replace(entry.getKey(), entry.getValue());
|
||||
|
||||
Reference in new issue
Block a user