|
3 | 3 | import com.clear.clearmybackground.mixin.early.GuiMainMenuAccessor; |
4 | 4 | import com.clear.clearmybackground.mixininterface.IGuiMainMenuMixin; |
5 | 5 | import net.minecraft.client.Minecraft; |
6 | | -import net.minecraft.client.gui.Gui; |
7 | | -import net.minecraft.client.gui.GuiMainMenu; |
8 | | -import net.minecraft.client.gui.ScaledResolution; |
| 6 | +import net.minecraft.client.gui.*; |
9 | 7 | import net.minecraft.client.renderer.GlStateManager; |
10 | 8 | import net.minecraft.util.ResourceLocation; |
| 9 | +import net.minecraftforge.fml.client.GuiNotification; |
11 | 10 | import org.lwjgl.opengl.GL11; |
12 | 11 |
|
13 | 12 | import javax.annotation.Nonnull; |
| 13 | +import javax.annotation.Nullable; |
14 | 14 |
|
15 | 15 | public class ClientHelper { |
16 | 16 |
|
@@ -45,11 +45,13 @@ public static void scissor(int screenX, int screenY, int boxWidth, int boxHeight |
45 | 45 | private static final ResourceLocation INWORLD_HEADER_SEPARATOR = new ResourceLocation(Tags.MOD_ID, "textures/gui/inworld_header_separator.png"); |
46 | 46 | private static final ResourceLocation INWORLD_FOOTER_SEPARATOR = new ResourceLocation(Tags.MOD_ID, "textures/gui/inworld_footer_separator.png"); |
47 | 47 |
|
48 | | - public static void renderWorldBackground(@Nonnull Minecraft mc, int width, int height) { |
| 48 | + public static boolean renderWorldBackground(@Nullable GuiScreen screen, @Nonnull Minecraft mc, int width, int height) { |
| 49 | + if (!shouldModifyBG(screen)) return false; |
49 | 50 | if (mc.world == null) { |
50 | 51 | renderPanorama(mc); |
51 | 52 | } |
52 | 53 | renderMenuBackground(mc, width, height); |
| 54 | + return true; |
53 | 55 | } |
54 | 56 |
|
55 | 57 | private static void renderMenuBackground(@Nonnull Minecraft mc, int width, int height) { |
@@ -114,4 +116,14 @@ public static void renderListBackground(@Nonnull Minecraft mc, int left, int top |
114 | 116 | if (blend) GlStateManager.enableBlend(); |
115 | 117 | else GlStateManager.disableBlend(); |
116 | 118 | } |
| 119 | + |
| 120 | + private static boolean shouldModifyBG(@Nullable GuiScreen screen) { |
| 121 | + if (!ClearMyBackground.GAME_LOADING_DONE || screen == null) return false; |
| 122 | + if (ClearMyBackground.FLUX_LOADING_LOADED && |
| 123 | + (screen instanceof GuiScreenWorking || screen instanceof GuiDownloadTerrain) |
| 124 | + ) return false; |
| 125 | + //noinspection RedundantIfStatement |
| 126 | + if (screen instanceof GuiNotification) return false; |
| 127 | + return true; |
| 128 | + } |
117 | 129 | } |
0 commit comments