Add some mixins to speed up dev time
This commit is contained in:
parent
b3449a2d63
commit
bb9201c58c
|
|
@ -1,6 +1,7 @@
|
|||
package org.embeddedt.modernfix.core.config;
|
||||
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
|
@ -62,6 +63,8 @@ public class ModernFixEarlyConfig {
|
|||
this.addMixinRule("safety", true);
|
||||
this.addMixinRule("launch.transformer_cache", false);
|
||||
this.addMixinRule("launch.class_search_cache", true);
|
||||
boolean isDevEnv = !FMLLoader.isProduction() && FMLLoader.getLoadingModList().getModFileById("modernfix").getFile().getLocator() instanceof ExplodedDirectoryLocator;
|
||||
this.addMixinRule("devenv", isDevEnv);
|
||||
|
||||
/* Mod compat */
|
||||
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package org.embeddedt.modernfix.mixin.devenv;
|
||||
|
||||
import com.mojang.authlib.minecraft.OfflineSocialInteractions;
|
||||
import com.mojang.authlib.minecraft.SocialInteractionsService;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftMixin {
|
||||
@Inject(method = "createSocialInteractions", at = @At("HEAD"), cancellable = true)
|
||||
private void noSocialInteraction(CallbackInfoReturnable<SocialInteractionsService> cir) {
|
||||
cir.setReturnValue(new OfflineSocialInteractions());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package org.embeddedt.modernfix.mixin.devenv;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
/* Disable waiting for spawn chunk load */
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class MinecraftServerMixin {
|
||||
@Redirect(method = "prepareLevels", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;getTickingGenerated()I"))
|
||||
private int noSpawnChunkWait(ServerChunkCache cache) {
|
||||
return 441;
|
||||
}
|
||||
|
||||
@Redirect(method = "prepareLevels", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;waitUntilNextTick()V"))
|
||||
private void noWaitTick(MinecraftServer server) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.embeddedt.modernfix.mixin.devenv;
|
||||
|
||||
import com.mojang.text2speech.Narrator;
|
||||
import com.mojang.text2speech.NarratorDummy;
|
||||
import net.minecraft.client.gui.chat.NarratorChatListener;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(NarratorChatListener.class)
|
||||
public class NarratorMixin {
|
||||
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lcom/mojang/text2speech/Narrator;getNarrator()Lcom/mojang/text2speech/Narrator;"))
|
||||
private Narrator useDummyNarrator() {
|
||||
return new NarratorDummy();
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,8 @@
|
|||
"perf.fast_registry_validation.ForgeRegistryMixin",
|
||||
"perf.cache_strongholds.ChunkGeneratorMixin",
|
||||
"perf.cache_upgraded_structures.StructureManagerMixin",
|
||||
"perf.cache_strongholds.ServerLevelMixin"
|
||||
"perf.cache_strongholds.ServerLevelMixin",
|
||||
"devenv.MinecraftServerMixin",
|
||||
],
|
||||
"client": [
|
||||
"core.MinecraftMixin",
|
||||
|
|
@ -100,7 +101,9 @@
|
|||
"perf.use_integrated_resources.PiglinBarteringRecipeBuilderMixin",
|
||||
"perf.jeresources_startup.VillagerEntryMixin",
|
||||
"bugfix.mc218112.SynchedEntityDataMixin_Client",
|
||||
"perf.faster_singleplayer_load.MinecraftServerMixin"
|
||||
"perf.faster_singleplayer_load.MinecraftServerMixin",
|
||||
"devenv.MinecraftMixin",
|
||||
"devenv.NarratorMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user