hiding title screen branding if others were removed

This commit is contained in:
CCr4ft3r
2023-04-13 18:05:28 +02:00
parent 976708d517
commit e373e4d8ed
@@ -6,6 +6,7 @@ import com.mojang.logging.LogUtils;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.internal.BrandingControl;
@@ -23,8 +24,8 @@ public class TitleScreenInjector {
private static boolean launchComplete = false;
@SuppressWarnings({"InstantiationOfUtilityClass", "unchecked"})
@SubscribeEvent
public static void onScreenInit(ScreenEvent.InitScreenEvent event) {
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onScreenInit(ScreenEvent.InitScreenEvent.Post event) {
if (!(event.getScreen() instanceof TitleScreen) || launchComplete)
return;
launchComplete = true;
@@ -40,6 +41,7 @@ public class TitleScreenInjector {
computeBranding.invoke(null);
List<String> brandings = new ArrayList<>((List<String>) f.get(brandingControl));
LogUtils.getLogger().info("ERRORR: " + brandings);
if (brandings.size() > 1) {
List<String> newBrandings = new ArrayList<>(brandings);
f.set(brandingControl, newBrandings);