Merge remote-tracking branch 'origin/1.16' into 1.18
This commit is contained in:
commit
f3f66e1873
13
build.gradle
13
build.gradle
|
|
@ -28,6 +28,10 @@ allprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
architectury {
|
||||||
|
compileOnly()
|
||||||
|
}
|
||||||
|
|
||||||
group = 'org.embeddedt'
|
group = 'org.embeddedt'
|
||||||
// extract base version from tag, generate other metadata ourselves
|
// extract base version from tag, generate other metadata ourselves
|
||||||
def details = versionDetails()
|
def details = versionDetails()
|
||||||
|
|
@ -189,6 +193,15 @@ configure(subprojects.findAll {it.name == "forge" || it.name == "fabric"}) {
|
||||||
apply plugin: 'com.matthewprenger.cursegradle'
|
apply plugin: 'com.matthewprenger.cursegradle'
|
||||||
apply plugin: 'com.modrinth.minotaur'
|
apply plugin: 'com.modrinth.minotaur'
|
||||||
|
|
||||||
|
loom {
|
||||||
|
mods {
|
||||||
|
main { // to match the default mod generated for Forge
|
||||||
|
sourceSet project.sourceSets.main
|
||||||
|
sourceSet project(':common').sourceSets.main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def copyJarNameConsistent = tasks.register('copyJarNameConsistent', Copy) {
|
def copyJarNameConsistent = tasks.register('copyJarNameConsistent', Copy) {
|
||||||
from remapJar // shortcut for createJar.outputs.files
|
from remapJar // shortcut for createJar.outputs.files
|
||||||
into project.file("build/libs")
|
into project.file("build/libs")
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,15 @@ public class ModernFix {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.snapshot_easter_egg.NameChange") && !SharedConstants.getCurrentVersion().isStable())
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.snapshot_easter_egg.NameChange") && !SharedConstants.getCurrentVersion().isStable())
|
||||||
NAME = "PreemptiveFix";
|
NAME = "PreemptiveFix";
|
||||||
ModernFixPlatformHooks.onServerCommandRegister(ModernFixCommands::register);
|
ModernFixPlatformHooks.INSTANCE.onServerCommandRegister(ModernFixCommands::register);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onServerStarted() {
|
public void onServerStarted() {
|
||||||
if(ModernFixPlatformHooks.isDedicatedServer()) {
|
if(ModernFixPlatformHooks.INSTANCE.isDedicatedServer()) {
|
||||||
float gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
float gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.ServerLoad"))
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.ServerLoad"))
|
||||||
ModernFix.LOGGER.warn("Dedicated server took " + gameStartTime + " seconds to load");
|
ModernFix.LOGGER.warn("Dedicated server took " + gameStartTime + " seconds to load");
|
||||||
ModernFixPlatformHooks.onLaunchComplete();
|
ModernFixPlatformHooks.INSTANCE.onLaunchComplete();
|
||||||
}
|
}
|
||||||
ClassInfoManager.clear();
|
ClassInfoManager.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ public class ModernFixClient {
|
||||||
// clear reserve as it's not needed
|
// clear reserve as it's not needed
|
||||||
MemoryReserve.release();
|
MemoryReserve.release();
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.branding.F3Screen")) {
|
||||||
brandingString = ModernFix.NAME + " " + ModernFixPlatformHooks.getVersionString();
|
brandingString = ModernFix.NAME + " " + ModernFixPlatformHooks.INSTANCE.getVersionString();
|
||||||
}
|
}
|
||||||
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
|
SearchTreeProviderRegistry.register(JEIBackedSearchTree.PROVIDER);
|
||||||
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);
|
SearchTreeProviderRegistry.register(REIBackedSearchTree.PROVIDER);
|
||||||
for(String className : ModernFixPlatformHooks.getCustomModOptions().get(IntegrationConstants.CLIENT_INTEGRATION_CLASS)) {
|
for(String className : ModernFixPlatformHooks.INSTANCE.getCustomModOptions().get(IntegrationConstants.CLIENT_INTEGRATION_CLASS)) {
|
||||||
try {
|
try {
|
||||||
CLIENT_INTEGRATIONS.add((ModernFixClientIntegration)Class.forName(className).getDeclaredConstructor().newInstance());
|
CLIENT_INTEGRATIONS.add((ModernFixClientIntegration)Class.forName(className).getDeclaredConstructor().newInstance());
|
||||||
} catch(ReflectiveOperationException | ClassCastException e) {
|
} catch(ReflectiveOperationException | ClassCastException e) {
|
||||||
|
|
@ -73,7 +73,7 @@ public class ModernFixClient {
|
||||||
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.GameLoad"))
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.GameLoad"))
|
||||||
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
|
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
|
||||||
ModernFixPlatformHooks.onLaunchComplete();
|
ModernFixPlatformHooks.INSTANCE.onLaunchComplete();
|
||||||
ClassInfoManager.clear();
|
ClassInfoManager.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public abstract class TextureAtlasMixin {
|
||||||
*/
|
*/
|
||||||
@Inject(method = "getBasicSpriteInfos", at = @At("HEAD"))
|
@Inject(method = "getBasicSpriteInfos", at = @At("HEAD"))
|
||||||
private void loadImages(ResourceManager manager, Set<ResourceLocation> imageLocations, CallbackInfoReturnable<Collection<TextureAtlasSprite.Info>> cir) {
|
private void loadImages(ResourceManager manager, Set<ResourceLocation> imageLocations, CallbackInfoReturnable<Collection<TextureAtlasSprite.Info>> cir) {
|
||||||
usingFasterLoad = ModernFixPlatformHooks.isLoadingNormally();
|
usingFasterLoad = ModernFixPlatformHooks.INSTANCE.isLoadingNormally();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "getBasicSpriteInfos", at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", ordinal = 0))
|
@Redirect(method = "getBasicSpriteInfos", at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", ordinal = 0))
|
||||||
|
|
@ -107,7 +107,7 @@ public abstract class TextureAtlasMixin {
|
||||||
} else {
|
} else {
|
||||||
TextureAtlasSprite sprite = null;
|
TextureAtlasSprite sprite = null;
|
||||||
try {
|
try {
|
||||||
sprite = ModernFixPlatformHooks.loadTextureAtlasSprite((TextureAtlas)(Object)this, resourceManager, spriteInfo, pair.getFirst(), storageX, storageY, x, y, mipLevel, pair.getSecond());
|
sprite = ModernFixPlatformHooks.INSTANCE.loadTextureAtlasSprite((TextureAtlas)(Object)this, resourceManager, spriteInfo, pair.getFirst(), storageX, storageY, x, y, mipLevel, pair.getSecond());
|
||||||
} catch(RuntimeException e) {
|
} catch(RuntimeException e) {
|
||||||
ModernFix.LOGGER.error("Error loading texture {}: {}", spriteInfo.name(), e);
|
ModernFix.LOGGER.error("Error loading texture {}: {}", spriteInfo.name(), e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class StitcherMixin {
|
||||||
*/
|
*/
|
||||||
@Inject(method = "stitch", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "stitch", at = @At("HEAD"), cancellable = true)
|
||||||
private void stitchFast(CallbackInfo ci) {
|
private void stitchFast(CallbackInfo ci) {
|
||||||
if(!ModernFixPlatformHooks.isLoadingNormally()) {
|
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally()) {
|
||||||
ModernFix.LOGGER.error("Using vanilla stitcher implementation due to invalid loading state");
|
ModernFix.LOGGER.error("Using vanilla stitcher implementation due to invalid loading state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ public class StitcherMixin {
|
||||||
*/
|
*/
|
||||||
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
|
||||||
private void gatherSpritesFast(Stitcher.SpriteLoader spriteLoader, CallbackInfo ci) {
|
private void gatherSpritesFast(Stitcher.SpriteLoader spriteLoader, CallbackInfo ci) {
|
||||||
if(!ModernFixPlatformHooks.isLoadingNormally())
|
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally())
|
||||||
return;
|
return;
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
for(StbStitcher.LoadableSpriteInfo info : loadableSpriteInfos) {
|
for(StbStitcher.LoadableSpriteInfo info : loadableSpriteInfos) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
|
||||||
public ModernFixMixinPlugin() {
|
public ModernFixMixinPlugin() {
|
||||||
/* invoke early to ensure it gets read on one thread */
|
/* invoke early to ensure it gets read on one thread */
|
||||||
ModernFixPlatformHooks.getCustomModOptions();
|
ModernFixPlatformHooks.INSTANCE.getCustomModOptions();
|
||||||
boolean firstConfig = instance == null;
|
boolean firstConfig = instance == null;
|
||||||
if(firstConfig) {
|
if(firstConfig) {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
@ -33,7 +33,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info("Loaded configuration file for ModernFix {}: {} options available, {} override(s) found",
|
this.logger.info("Loaded configuration file for ModernFix {}: {} options available, {} override(s) found",
|
||||||
ModernFixPlatformHooks.getVersionString(), config.getOptionCount(), config.getOptionOverrideCount());
|
ModernFixPlatformHooks.INSTANCE.getVersionString(), config.getOptionCount(), config.getOptionOverrideCount());
|
||||||
|
|
||||||
config.getOptionMap().values().forEach(option -> {
|
config.getOptionMap().values().forEach(option -> {
|
||||||
if (option.isOverridden()) {
|
if (option.isOverridden()) {
|
||||||
|
|
@ -41,7 +41,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
|
||||||
if (option.isUserDefined()) {
|
if (option.isUserDefined()) {
|
||||||
source = "user configuration";
|
source = "user configuration";
|
||||||
} else if (!ModernFixPlatformHooks.isEarlyLoadingNormally()) {
|
} else if (!ModernFixPlatformHooks.INSTANCE.isEarlyLoadingNormally()) {
|
||||||
source = "load error";
|
source = "load error";
|
||||||
} else if (option.isModDefined()) {
|
} else if (option.isModDefined()) {
|
||||||
source = "mods [" + String.join(", ", option.getDefiningMods()) + "]";
|
source = "mods [" + String.join(", ", option.getDefiningMods()) + "]";
|
||||||
|
|
@ -64,7 +64,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We abuse the constructor of a mixin plugin as a safe location to start modifying the classloader */
|
/* We abuse the constructor of a mixin plugin as a safe location to start modifying the classloader */
|
||||||
ModernFixPlatformHooks.injectPlatformSpecificHacks();
|
ModernFixPlatformHooks.INSTANCE.injectPlatformSpecificHacks();
|
||||||
|
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spam_thread_dump.ThreadDumper")) {
|
||||||
// run once to trigger classloading
|
// run once to trigger classloading
|
||||||
|
|
@ -119,7 +119,7 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
String msg = "No rules matched mixin '{}', treating as foreign and disabling!";
|
String msg = "No rules matched mixin '{}', treating as foreign and disabling!";
|
||||||
if(ModernFixPlatformHooks.isDevEnv())
|
if(ModernFixPlatformHooks.INSTANCE.isDevEnv())
|
||||||
this.logger.error(msg, mixin);
|
this.logger.error(msg, mixin);
|
||||||
else
|
else
|
||||||
this.logger.debug(msg, mixin);
|
this.logger.debug(msg, mixin);
|
||||||
|
|
@ -146,6 +146,6 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||||
ModernFixPlatformHooks.applyASMTransformers(mixinClassName, targetClass);
|
ModernFixPlatformHooks.INSTANCE.applyASMTransformers(mixinClassName, targetClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ public class ModernFixEarlyConfig {
|
||||||
if(modId.equals("optifine"))
|
if(modId.equals("optifine"))
|
||||||
return OPTIFINE_PRESENT;
|
return OPTIFINE_PRESENT;
|
||||||
else
|
else
|
||||||
return ModernFixPlatformHooks.modPresent(modId);
|
return ModernFixPlatformHooks.INSTANCE.modPresent(modId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String MIXIN_DESC = Type.getDescriptor(Mixin.class);
|
private static final String MIXIN_DESC = Type.getDescriptor(Mixin.class);
|
||||||
|
|
@ -122,11 +122,11 @@ public class ModernFixEarlyConfig {
|
||||||
isDevOnly = true;
|
isDevOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isMixin && (!isDevOnly || ModernFixPlatformHooks.isDevEnv())) {
|
if(isMixin && (!isDevOnly || ModernFixPlatformHooks.INSTANCE.isDevEnv())) {
|
||||||
String mixinClassName = sanitize(node.name.replace('/', '.')).replace("org.embeddedt.modernfix.mixin.", "");
|
String mixinClassName = sanitize(node.name.replace('/', '.')).replace("org.embeddedt.modernfix.mixin.", "");
|
||||||
if(!requiredModPresent)
|
if(!requiredModPresent)
|
||||||
mixinsMissingMods.put(mixinClassName, requiredModId);
|
mixinsMissingMods.put(mixinClassName, requiredModId);
|
||||||
else if(isClientOnly && !ModernFixPlatformHooks.isClient())
|
else if(isClientOnly && !ModernFixPlatformHooks.INSTANCE.isClient())
|
||||||
mixinsMissingMods.put(mixinClassName, "[not client]");
|
mixinsMissingMods.put(mixinClassName, "[not client]");
|
||||||
List<String> mixinOptionNames = dotSplitter.splitToList(mixinClassName);
|
List<String> mixinOptionNames = dotSplitter.splitToList(mixinClassName);
|
||||||
StringBuilder optionBuilder = new StringBuilder(mixinClassName.length());
|
StringBuilder optionBuilder = new StringBuilder(mixinClassName.length());
|
||||||
|
|
@ -150,7 +150,7 @@ public class ModernFixEarlyConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean isDevEnv = ModernFixPlatformHooks.isDevEnv();
|
private static final boolean isDevEnv = ModernFixPlatformHooks.INSTANCE.isDevEnv();
|
||||||
|
|
||||||
private static class DefaultSettingMapBuilder extends ImmutableMap.Builder<String, Boolean> {
|
private static class DefaultSettingMapBuilder extends ImmutableMap.Builder<String, Boolean> {
|
||||||
public DefaultSettingMapBuilder putConditionally(BooleanSupplier condition, String k, Boolean v) {
|
public DefaultSettingMapBuilder putConditionally(BooleanSupplier condition, String k, Boolean v) {
|
||||||
|
|
@ -169,7 +169,7 @@ public class ModernFixEarlyConfig {
|
||||||
private static final ImmutableMap<String, Boolean> DEFAULT_SETTING_OVERRIDES = new DefaultSettingMapBuilder()
|
private static final ImmutableMap<String, Boolean> DEFAULT_SETTING_OVERRIDES = new DefaultSettingMapBuilder()
|
||||||
.put("mixin.perf.dynamic_resources", false)
|
.put("mixin.perf.dynamic_resources", false)
|
||||||
.put("mixin.feature.direct_stack_trace", false)
|
.put("mixin.feature.direct_stack_trace", false)
|
||||||
.putConditionally(ModernFixPlatformHooks::isDevEnv, "mixin.perf.rewrite_registry", false)
|
.putConditionally(ModernFixPlatformHooks.INSTANCE::isDevEnv, "mixin.perf.rewrite_registry", false)
|
||||||
.put("mixin.perf.clear_mixin_classinfo", false)
|
.put("mixin.perf.clear_mixin_classinfo", false)
|
||||||
.put("mixin.perf.deduplicate_climate_parameters", false)
|
.put("mixin.perf.deduplicate_climate_parameters", false)
|
||||||
.put("mixin.bugfix.packet_leak", false)
|
.put("mixin.bugfix.packet_leak", false)
|
||||||
|
|
@ -242,7 +242,7 @@ public class ModernFixEarlyConfig {
|
||||||
|
|
||||||
private void disableIfModPresent(String configName, String... ids) {
|
private void disableIfModPresent(String configName, String... ids) {
|
||||||
for(String id : ids) {
|
for(String id : ids) {
|
||||||
if(!ModernFixPlatformHooks.isEarlyLoadingNormally() || modPresent(id)) {
|
if(!ModernFixPlatformHooks.INSTANCE.isEarlyLoadingNormally() || modPresent(id)) {
|
||||||
Option option = this.options.get(configName);
|
Option option = this.options.get(configName);
|
||||||
if(option != null)
|
if(option != null)
|
||||||
option.addModOverride(false, id);
|
option.addModOverride(false, id);
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ public class ModelBakeryHelpers {
|
||||||
Set<ResourceLocation> modelFiles, UnbakedModel missingModel,
|
Set<ResourceLocation> modelFiles, UnbakedModel missingModel,
|
||||||
Function<JsonElement, BlockModel> modelDeserializer,
|
Function<JsonElement, BlockModel> modelDeserializer,
|
||||||
Function<ResourceLocation, UnbakedModel> bakeryModelGetter) {
|
Function<ResourceLocation, UnbakedModel> bakeryModelGetter) {
|
||||||
if(!ModernFixPlatformHooks.isLoadingNormally())
|
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally())
|
||||||
return;
|
return;
|
||||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||||
final Object2IntOpenHashMap<String> blockstateErrors = new Object2IntOpenHashMap<>();
|
final Object2IntOpenHashMap<String> blockstateErrors = new Object2IntOpenHashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class EntityDataIDSyncHandler {
|
||||||
}
|
}
|
||||||
EntityIDSyncPacket packet = new EntityIDSyncPacket(fieldsToSyncMap);
|
EntityIDSyncPacket packet = new EntityIDSyncPacket(fieldsToSyncMap);
|
||||||
ModernFix.LOGGER.debug("Sending ID correction packet to client with " + fieldsToSyncMap.size() + " classes");
|
ModernFix.LOGGER.debug("Sending ID correction packet to client with " + fieldsToSyncMap.size() + " classes");
|
||||||
ModernFixPlatformHooks.sendPacket(targetPlayer, packet);
|
ModernFixPlatformHooks.INSTANCE.sendPacket(targetPlayer, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.embeddedt.modernfix.platform;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
|
@ -16,59 +15,60 @@ import org.objectweb.asm.tree.ClassNode;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class ModernFixPlatformHooks {
|
public interface ModernFixPlatformHooks {
|
||||||
@ExpectPlatform
|
ModernFixPlatformHooks INSTANCE = PlatformHookLoader.findInstance();
|
||||||
public static boolean isClient() {
|
|
||||||
|
default boolean isClient() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isDedicatedServer() {
|
default boolean isDedicatedServer() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static String getVersionString() {
|
default String getVersionString() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean modPresent(String modId) {
|
default boolean modPresent(String modId) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isDevEnv() {
|
default boolean isDevEnv() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void injectPlatformSpecificHacks() {
|
default void injectPlatformSpecificHacks() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
default void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static MinecraftServer getCurrentServer() {
|
default MinecraftServer getCurrentServer() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isEarlyLoadingNormally() {
|
default boolean isEarlyLoadingNormally() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isLoadingNormally() {
|
default boolean isLoadingNormally() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
default TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
||||||
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
||||||
Resource resource,
|
Resource resource,
|
||||||
int atlasWidth, int atlasHeight,
|
int atlasWidth, int atlasHeight,
|
||||||
|
|
@ -77,33 +77,33 @@ public class ModernFixPlatformHooks {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static Path getGameDirectory() {
|
default Path getGameDirectory() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void sendPacket(ServerPlayer player, Object packet) {
|
default void sendPacket(ServerPlayer player, Object packet) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
default void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static Multimap<String, String> getCustomModOptions() {
|
default Multimap<String, String> getCustomModOptions() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void onLaunchComplete() {
|
default void onLaunchComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static String getPlatformName() {
|
default String getPlatformName() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.embeddedt.modernfix.platform;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
|
class PlatformHookLoader {
|
||||||
|
static ModernFixPlatformHooks findInstance() {
|
||||||
|
String[] locations = new String[] { "forge", "fabric" };
|
||||||
|
for(String location : locations) {
|
||||||
|
try {
|
||||||
|
Class<?> clz = Class.forName("org.embeddedt.modernfix.platform." + location + ".ModernFixPlatformHooksImpl");
|
||||||
|
Constructor<?> constructor = clz.getConstructor();
|
||||||
|
constructor.setAccessible(true);
|
||||||
|
return (ModernFixPlatformHooks)constructor.newInstance();
|
||||||
|
} catch(ClassNotFoundException ignored) {
|
||||||
|
} catch(ReflectiveOperationException | ClassCastException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.err.println("ModernFix has failed to load platform hooks. It cannot function, the game will now close");
|
||||||
|
Runtime.getRuntime().exit(1);
|
||||||
|
throw new AssertionError("Somehow couldn't exit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ public class PackResourcesCacheEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void invalidate() {
|
public static void invalidate() {
|
||||||
if(!ModernFixPlatformHooks.isDevEnv())
|
if(!ModernFixPlatformHooks.INSTANCE.isDevEnv())
|
||||||
return;
|
return;
|
||||||
synchronized (cachingPacks) {
|
synchronized (cachingPacks) {
|
||||||
cachingPacks.keySet().forEach(pack -> {
|
cachingPacks.keySet().forEach(pack -> {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
|
||||||
});
|
});
|
||||||
if(!I18n.exists("modernfix.option." + optionName)) {
|
if(!I18n.exists("modernfix.option." + optionName)) {
|
||||||
this.helpButton.active = false;
|
this.helpButton.active = false;
|
||||||
if(ModernFixPlatformHooks.isDevEnv() && OPTIONS_MISSING_HELP.add(optionName))
|
if(ModernFixPlatformHooks.INSTANCE.isDevEnv() && OPTIONS_MISSING_HELP.add(optionName))
|
||||||
ModernFix.LOGGER.warn("Missing help for {}", optionName);
|
ModernFix.LOGGER.warn("Missing help for {}", optionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class CachingStructureManager {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private static final File STRUCTURE_CACHE_FOLDER = FileUtil.childFile(ModernFixPlatformHooks.getGameDirectory().resolve("modernfix").resolve("structureCacheV1").toFile());
|
private static final File STRUCTURE_CACHE_FOLDER = FileUtil.childFile(ModernFixPlatformHooks.INSTANCE.getGameDirectory().resolve("modernfix").resolve("structureCacheV1").toFile());
|
||||||
|
|
||||||
static {
|
static {
|
||||||
STRUCTURE_CACHE_FOLDER.mkdirs();
|
STRUCTURE_CACHE_FOLDER.mkdirs();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ configurations {
|
||||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||||
compileClasspath.extendsFrom common
|
compileClasspath.extendsFrom common
|
||||||
runtimeClasspath.extendsFrom common
|
runtimeClasspath.extendsFrom common
|
||||||
developmentFabric.extendsFrom common
|
|
||||||
|
|
||||||
modIncludeImplementation
|
modIncludeImplementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import org.embeddedt.modernfix.ModernFixFabric;
|
import org.embeddedt.modernfix.ModernFixFabric;
|
||||||
import org.embeddedt.modernfix.api.constants.IntegrationConstants;
|
import org.embeddedt.modernfix.api.constants.IntegrationConstants;
|
||||||
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
||||||
|
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
|
||||||
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
||||||
import org.embeddedt.modernfix.util.CommonModUtil;
|
import org.embeddedt.modernfix.util.CommonModUtil;
|
||||||
import org.objectweb.asm.tree.*;
|
import org.objectweb.asm.tree.*;
|
||||||
|
|
@ -28,18 +29,18 @@ import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class ModernFixPlatformHooksImpl {
|
public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks {
|
||||||
public static boolean isClient() {
|
public boolean isClient() {
|
||||||
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDedicatedServer() {
|
public boolean isDedicatedServer() {
|
||||||
return FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER;
|
return FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String verString;
|
private static String verString;
|
||||||
|
|
||||||
public static String getVersionString() {
|
public String getVersionString() {
|
||||||
if(verString == null) {
|
if(verString == null) {
|
||||||
ModContainer mfModContainer = FabricLoader.getInstance().getModContainer("modernfix").get();
|
ModContainer mfModContainer = FabricLoader.getInstance().getModContainer("modernfix").get();
|
||||||
verString = mfModContainer.getMetadata().getVersion().getFriendlyString();
|
verString = mfModContainer.getMetadata().getVersion().getFriendlyString();
|
||||||
|
|
@ -47,27 +48,27 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return verString;
|
return verString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean modPresent(String modId) {
|
public boolean modPresent(String modId) {
|
||||||
return FabricLoader.getInstance().getModContainer(modId).isPresent();
|
return FabricLoader.getInstance().getModContainer(modId).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDevEnv() {
|
public boolean isDevEnv() {
|
||||||
return FabricLoader.getInstance().isDevelopmentEnvironment();
|
return FabricLoader.getInstance().isDevelopmentEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MinecraftServer getCurrentServer() {
|
public MinecraftServer getCurrentServer() {
|
||||||
return ModernFixFabric.theServer.get();
|
return ModernFixFabric.theServer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEarlyLoadingNormally() {
|
public boolean isEarlyLoadingNormally() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLoadingNormally() {
|
public boolean isLoadingNormally() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
public TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
||||||
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
||||||
Resource resource,
|
Resource resource,
|
||||||
int atlasWidth, int atlasHeight,
|
int atlasWidth, int atlasHeight,
|
||||||
|
|
@ -76,27 +77,27 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return new TextureAtlasSprite(atlasTexture, textureInfo, mipmapLevel, atlasWidth, atlasHeight, spriteX, spriteY, image);
|
return new TextureAtlasSprite(atlasTexture, textureInfo, mipmapLevel, atlasWidth, atlasHeight, spriteX, spriteY, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getGameDirectory() {
|
public Path getGameDirectory() {
|
||||||
return FabricLoader.getInstance().getGameDir();
|
return FabricLoader.getInstance().getGameDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacket(ServerPlayer player, Object packet) {
|
public void sendPacket(ServerPlayer player, Object packet) {
|
||||||
//PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), packet);
|
//PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void injectPlatformSpecificHacks() {
|
public void injectPlatformSpecificHacks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
public void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
public void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, arg) -> handler.accept(dispatcher));
|
CommandRegistrationCallback.EVENT.register((dispatcher, arg) -> handler.accept(dispatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Multimap<String, String> modOptions;
|
private static Multimap<String, String> modOptions;
|
||||||
public static Multimap<String, String> getCustomModOptions() {
|
public Multimap<String, String> getCustomModOptions() {
|
||||||
if(modOptions == null) {
|
if(modOptions == null) {
|
||||||
modOptions = ArrayListMultimap.create();
|
modOptions = ArrayListMultimap.create();
|
||||||
for (ModContainer container : FabricLoader.getInstance().getAllMods()) {
|
for (ModContainer container : FabricLoader.getInstance().getAllMods()) {
|
||||||
|
|
@ -117,13 +118,13 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return modOptions;
|
return modOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLaunchComplete() {
|
public void onLaunchComplete() {
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnFabric")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnFabric")) {
|
||||||
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.stop("launch"), "Failed to stop profiler");
|
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.stop("launch"), "Failed to stop profiler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPlatformName() {
|
public String getPlatformName() {
|
||||||
return "Fabric";
|
return "Fabric";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ configurations {
|
||||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||||
compileClasspath.extendsFrom common
|
compileClasspath.extendsFrom common
|
||||||
runtimeClasspath.extendsFrom common
|
runtimeClasspath.extendsFrom common
|
||||||
developmentForge.extendsFrom common
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import org.embeddedt.modernfix.api.constants.IntegrationConstants;
|
||||||
import org.embeddedt.modernfix.forge.classloading.FastAccessTransformerList;
|
import org.embeddedt.modernfix.forge.classloading.FastAccessTransformerList;
|
||||||
import org.embeddedt.modernfix.forge.config.NightConfigFixer;
|
import org.embeddedt.modernfix.forge.config.NightConfigFixer;
|
||||||
import org.embeddedt.modernfix.forge.packet.PacketHandler;
|
import org.embeddedt.modernfix.forge.packet.PacketHandler;
|
||||||
|
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
|
||||||
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
||||||
import org.embeddedt.modernfix.util.CommonModUtil;
|
import org.embeddedt.modernfix.util.CommonModUtil;
|
||||||
import org.embeddedt.modernfix.util.DummyList;
|
import org.embeddedt.modernfix.util.DummyList;
|
||||||
|
|
@ -42,18 +43,18 @@ import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class ModernFixPlatformHooksImpl {
|
public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks {
|
||||||
public static boolean isClient() {
|
public boolean isClient() {
|
||||||
return FMLLoader.getDist() == Dist.CLIENT;
|
return FMLLoader.getDist() == Dist.CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDedicatedServer() {
|
public boolean isDedicatedServer() {
|
||||||
return FMLLoader.getDist().isDedicatedServer();
|
return FMLLoader.getDist().isDedicatedServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String verString;
|
private static String verString;
|
||||||
|
|
||||||
public static String getVersionString() {
|
public String getVersionString() {
|
||||||
if(verString == null) {
|
if(verString == null) {
|
||||||
try {
|
try {
|
||||||
verString = ModernFixMixinPlugin.class.getPackage().getImplementationVersion();
|
verString = ModernFixMixinPlugin.class.getPackage().getImplementationVersion();
|
||||||
|
|
@ -65,28 +66,28 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return verString;
|
return verString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean modPresent(String modId) {
|
public boolean modPresent(String modId) {
|
||||||
return FMLLoader.getLoadingModList().getModFileById(modId) != null;
|
return FMLLoader.getLoadingModList().getModFileById(modId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDevEnv() {
|
public boolean isDevEnv() {
|
||||||
return !FMLLoader.isProduction();
|
return !FMLLoader.isProduction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MinecraftServer getCurrentServer() {
|
public MinecraftServer getCurrentServer() {
|
||||||
return ServerLifecycleHooks.getCurrentServer();
|
return ServerLifecycleHooks.getCurrentServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEarlyLoadingNormally() {
|
public boolean isEarlyLoadingNormally() {
|
||||||
return LoadingModList.get().getErrors().isEmpty();
|
return LoadingModList.get().getErrors().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLoadingNormally() {
|
public boolean isLoadingNormally() {
|
||||||
return isEarlyLoadingNormally() && ModLoader.isLoadingStateValid();
|
return isEarlyLoadingNormally() && ModLoader.isLoadingStateValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
public TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture,
|
||||||
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo,
|
||||||
Resource resource,
|
Resource resource,
|
||||||
int atlasWidth, int atlasHeight,
|
int atlasWidth, int atlasHeight,
|
||||||
|
|
@ -128,15 +129,15 @@ public class ModernFixPlatformHooksImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getGameDirectory() {
|
public Path getGameDirectory() {
|
||||||
return FMLPaths.GAMEDIR.get();
|
return FMLPaths.GAMEDIR.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacket(ServerPlayer player, Object packet) {
|
public void sendPacket(ServerPlayer player, Object packet) {
|
||||||
PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), packet);
|
PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void injectPlatformSpecificHacks() {
|
public void injectPlatformSpecificHacks() {
|
||||||
FastAccessTransformerList.attemptReplace();
|
FastAccessTransformerList.attemptReplace();
|
||||||
|
|
||||||
/* https://github.com/FabricMC/Mixin/pull/99 */
|
/* https://github.com/FabricMC/Mixin/pull/99 */
|
||||||
|
|
@ -158,18 +159,18 @@ public class ModernFixPlatformHooksImpl {
|
||||||
NightConfigFixer.monitorFileWatcher();
|
NightConfigFixer.monitorFileWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
public void applyASMTransformers(String mixinClassName, ClassNode targetClass) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
public void onServerCommandRegister(Consumer<CommandDispatcher<CommandSourceStack>> handler) {
|
||||||
MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent event) -> {
|
MinecraftForge.EVENT_BUS.addListener((RegisterCommandsEvent event) -> {
|
||||||
handler.accept(event.getDispatcher());
|
handler.accept(event.getDispatcher());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Multimap<String, String> modOptions;
|
private static Multimap<String, String> modOptions;
|
||||||
public static Multimap<String, String> getCustomModOptions() {
|
public Multimap<String, String> getCustomModOptions() {
|
||||||
if(modOptions == null) {
|
if(modOptions == null) {
|
||||||
modOptions = ArrayListMultimap.create();
|
modOptions = ArrayListMultimap.create();
|
||||||
for (ModInfo meta : LoadingModList.get().getMods()) {
|
for (ModInfo meta : LoadingModList.get().getMods()) {
|
||||||
|
|
@ -188,13 +189,13 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return modOptions;
|
return modOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLaunchComplete() {
|
public void onLaunchComplete() {
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnForge")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnForge")) {
|
||||||
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.stop("launch"), "Failed to stop profiler");
|
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.stop("launch"), "Failed to stop profiler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPlatformName() {
|
public String getPlatformName() {
|
||||||
return "Forge";
|
return "Forge";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user