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

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

}