Carpet

Carpet

2M Downloads

`MinecraftServer_tickspeedMixin` inject to `modifiedRunLoop` is too agressive.

OroArmor opened this issue ยท 3 comments

commented

Quilt Standard Libraries' Server READY event (analogous to Fabric's SERVER_STARTED event) fails to be run because of the mixin.

Carpet's Mixin:

@Inject(method = "runServer", at = @At(value = "INVOKE", shift = At.Shift.AFTER,
		target = "Lnet/minecraft/server/MinecraftServer;setFavicon(Lnet/minecraft/server/ServerMetadata;)V"))
private void modifiedRunLoop(CallbackInfo ci)
{
		// ... Method too long to paste
}

Quilt's Mixin:

@Inject(
		method = "runServer",
		at = @At(
				value = "INVOKE",
				target = "Lnet/minecraft/server/MinecraftServer;setFavicon(Lnet/minecraft/server/ServerMetadata;)V",
				shift = At.Shift.AFTER
		)
)
private void serverReady(CallbackInfo info) {
	ServerLifecycleEvents.READY.invoker().readyServer((MinecraftServer) (Object) this);
}

Fabric's Mixin:

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;setFavicon(Lnet/minecraft/server/ServerMetadata;)V", ordinal = 0), method = "runServer")
private void afterSetupServer(CallbackInfo info) {
	ServerLifecycleEvents.SERVER_STARTED.invoker().onServerStarted((MinecraftServer) (Object) this);
}

Quilt has since fixed the issue by reverting to Fabric's current mixin, however, other issues could arise from this aggressive injection point.

Because of how this mixin works, changing its priority to Integer.MAX_VALUE would fix the issue and prevent it from happening to other modders.

commented

Mixin priorities always have effects. And mod loading order is deterministically in production environment in fabric loader 0.12+ (search order in https://fabricmc.net/2021/10/03/loader-0120.html)

The modifiedRunLoop thing is quite annoying if you want to hook into the minecraft tick loop, since it's logic is rewritten in the mixin method and there's no way to hook into carpet's impl

commented

I never seen the priority to have any effect cross-mods. Maybe things have changed, but last time I checked, it only applies within your own mod and mods are loaded rather in-deterministically. Please correct me if I am wrong. I wish to wrong here.

commented

Should be fixed in 1ad927d