aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java
blob: dbdad65a26b6399aff4b736d1b2ec1447b6b7002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package io.github.moulberry.notenoughupdates.mixins;

import io.github.moulberry.notenoughupdates.miscfeatures.FancyPortals;
import net.minecraft.client.LoadingScreenRenderer;
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.CallbackInfo;

@Mixin(LoadingScreenRenderer.class)
public class MixinLoadingScreenRenderer {
	@Inject(method = "setLoadingProgress", at = @At(value = "HEAD"), cancellable = true)
	public void setLoadingProgress(int progress, CallbackInfo ci) {
		if (progress < 0 && !FancyPortals.shouldRenderLoadingScreen()) {
			ci.cancel();
		}
	}
}