Merge remote-tracking branch 'origin/1.19.4' into 1.20
This commit is contained in:
commit
4e3dc99479
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()
|
||||||
|
|
@ -200,6 +204,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public abstract class MinecraftMixin {
|
||||||
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, nameSupplier);
|
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, nameSupplier);
|
||||||
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, tagSupplier);
|
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, tagSupplier);
|
||||||
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new DummySearchTree<>());
|
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new DummySearchTree<>());
|
||||||
ModernFixPlatformHooks.registerCreativeSearchTrees(this.searchRegistry, nameSupplier, tagSupplier, this::populateSearchTree);
|
ModernFixPlatformHooks.INSTANCE.registerCreativeSearchTrees(this.searchRegistry, nameSupplier, tagSupplier, this::populateSearchTree);
|
||||||
// grab components for all key mappings in order to prevent them from being loaded off-thread later
|
// grab components for all key mappings in order to prevent them from being loaded off-thread later
|
||||||
// this populates the LazyLoadedValues
|
// this populates the LazyLoadedValues
|
||||||
// we also need to suppress GLFW errors to prevent crashes if a key is missing
|
// we also need to suppress GLFW errors to prevent crashes if a key is missing
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class StitcherMixin<T extends Stitcher.Entry> {
|
||||||
*/
|
*/
|
||||||
@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;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public class StitcherMixin<T extends Stitcher.Entry> {
|
||||||
*/
|
*/
|
||||||
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
|
||||||
private void gatherSpritesFast(Stitcher.SpriteLoader<T> spriteLoader, CallbackInfo ci) {
|
private void gatherSpritesFast(Stitcher.SpriteLoader<T> spriteLoader, CallbackInfo ci) {
|
||||||
if(!ModernFixPlatformHooks.isLoadingNormally())
|
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally())
|
||||||
return;
|
return;
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
for(StbStitcher.LoadableSpriteInfo<T> info : loadableSpriteInfos) {
|
for(StbStitcher.LoadableSpriteInfo<T> 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)
|
||||||
|
|
@ -243,7 +243,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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package org.embeddedt.modernfix.platform;
|
||||||
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
|
||||||
import net.minecraft.client.searchtree.SearchRegistry;
|
import net.minecraft.client.searchtree.SearchRegistry;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
@ -15,89 +14,86 @@ import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
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
|
default Path getGameDirectory() {
|
||||||
public static 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
|
default void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
||||||
public static void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onLaunchComplete() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExpectPlatform
|
default String getPlatformName() {
|
||||||
public static void onLaunchComplete() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static 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 -> {
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
|
||||||
}).pos(75, 0).size(20, 20).build();
|
}).pos(75, 0).size(20, 20).build();
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class JEIBackedSearchTree extends DummySearchTree<ItemStack> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse() {
|
public boolean canUse() {
|
||||||
return ModernFixPlatformHooks.modPresent("jei") && !ModernFixPlatformHooks.modPresent("emi") && getIngredientListUncached != null && filterField != null;
|
return ModernFixPlatformHooks.INSTANCE.modPresent("jei") && !ModernFixPlatformHooks.INSTANCE.modPresent("emi") && getIngredientListUncached != null && filterField != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class REIBackedSearchTree extends DummySearchTree<ItemStack> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse() {
|
public boolean canUse() {
|
||||||
return ModernFixPlatformHooks.modPresent("roughlyenoughitems");
|
return ModernFixPlatformHooks.INSTANCE.modPresent("roughlyenoughitems");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -87,17 +87,17 @@ public class SparkLaunchProfiler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return ModernFixPlatformHooks.isClient() ? Type.CLIENT : Type.SERVER;
|
return ModernFixPlatformHooks.INSTANCE.isClient() ? Type.CLIENT : Type.SERVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return ModernFixPlatformHooks.getPlatformName();
|
return ModernFixPlatformHooks.INSTANCE.getPlatformName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return ModernFixPlatformHooks.getVersionString();
|
return ModernFixPlatformHooks.INSTANCE.getVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,7 +146,7 @@ public class SparkLaunchProfiler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path getPluginDirectory() {
|
public Path getPluginDirectory() {
|
||||||
return ModernFixPlatformHooks.getGameDirectory().resolve("spark-modernfix");
|
return ModernFixPlatformHooks.INSTANCE.getGameDirectory().resolve("spark-modernfix");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@ import net.minecraft.world.item.ItemStack;
|
||||||
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.ClassNode;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -28,18 +29,18 @@ import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
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,47 +48,47 @@ 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 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, env) -> handler.accept(dispatcher));
|
CommandRegistrationCallback.EVENT.register((dispatcher, arg, env) -> 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()) {
|
||||||
|
|
@ -108,21 +109,20 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return modOptions;
|
return modOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
||||||
public static void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
|
||||||
CreativeModeTabs.searchTab().setSearchTreeBuilder((list) -> {
|
CreativeModeTabs.searchTab().setSearchTreeBuilder((list) -> {
|
||||||
populator.accept(SearchRegistry.CREATIVE_NAMES, list);
|
populator.accept(SearchRegistry.CREATIVE_NAMES, list);
|
||||||
populator.accept(SearchRegistry.CREATIVE_TAGS, list);
|
populator.accept(SearchRegistry.CREATIVE_TAGS, list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
||||||
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;
|
||||||
|
|
@ -39,18 +40,18 @@ import java.util.Objects;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
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();
|
||||||
|
|
@ -62,35 +63,35 @@ 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 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 */
|
||||||
|
|
@ -112,18 +113,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()) {
|
||||||
|
|
@ -142,7 +143,7 @@ public class ModernFixPlatformHooksImpl {
|
||||||
return modOptions;
|
return modOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
public void registerCreativeSearchTrees(SearchRegistry registry, SearchRegistry.TreeBuilderSupplier<ItemStack> nameSupplier, SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier, BiConsumer<SearchRegistry.Key<ItemStack>, List<ItemStack>> populator) {
|
||||||
for (SearchRegistry.Key<ItemStack> nameKey : CreativeModeTabSearchRegistry.getNameSearchKeys().values()) {
|
for (SearchRegistry.Key<ItemStack> nameKey : CreativeModeTabSearchRegistry.getNameSearchKeys().values()) {
|
||||||
registry.register(nameKey, nameSupplier);
|
registry.register(nameKey, nameSupplier);
|
||||||
}
|
}
|
||||||
|
|
@ -159,13 +160,13 @@ public class ModernFixPlatformHooksImpl {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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