aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java
blob: d98add96156df171631898fa2a4f9ed86e855750 (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();
        }
    }
}