Allow debugReloader option to also work with datapack reloads
Related: #397
This commit is contained in:
parent
66ef30449a
commit
4ee8c41abd
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.embeddedt.modernfix.common.mixin.feature.measure_time;
|
||||||
|
|
||||||
|
import net.minecraft.server.packs.resources.SimpleReloadInstance;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
|
@Mixin(SimpleReloadInstance.class)
|
||||||
|
public class SimpleReloadInstanceMixin {
|
||||||
|
// TODO maybe expose as a mixin config
|
||||||
|
private static final boolean ENABLE_DEBUG_RELOADER = Boolean.getBoolean("modernfix.debugReloader");
|
||||||
|
/**
|
||||||
|
* @author embeddedt
|
||||||
|
* @reason add ability to use this feature in modpacks
|
||||||
|
*/
|
||||||
|
@ModifyVariable(method = "create", at = @At("HEAD"), argsOnly = true)
|
||||||
|
private static boolean enableDebugReloader(boolean bl) {
|
||||||
|
return bl || ENABLE_DEBUG_RELOADER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package org.embeddedt.modernfix.common.mixin.feature.measure_time;
|
|
||||||
|
|
||||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
|
||||||
|
|
||||||
@Mixin(ReloadableResourceManager.class)
|
|
||||||
public class SimpleReloadableResourceManagerMixin {
|
|
||||||
// TODO maybe expose as a mixin config
|
|
||||||
private static final boolean ENABLE_DEBUG_RELOADER = Boolean.getBoolean("modernfix.debugReloader");
|
|
||||||
/**
|
|
||||||
* @author embeddedt
|
|
||||||
* @reason add ability to use this feature in modpacks
|
|
||||||
*/
|
|
||||||
@ModifyArg(method = "createReload", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/SimpleReloadInstance;create(Lnet/minecraft/server/packs/resources/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Z)Lnet/minecraft/server/packs/resources/ReloadInstance;"), index = 5)
|
|
||||||
private boolean enableDebugReloader(boolean bl) {
|
|
||||||
return bl || ENABLE_DEBUG_RELOADER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user