Search in sources :

Example 1 with ExtendedButton

use of net.minecraftforge.client.gui.widget.ExtendedButton in project MinecraftForge by MinecraftForge.

the class LoadingErrorScreen method init.

@Override
public void init() {
    super.init();
    this.clearWidgets();
    this.errorHeader = new TextComponent(ChatFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + ChatFormatting.RESET);
    this.warningHeader = new TextComponent(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + ChatFormatting.RESET);
    int yOffset = 46;
    this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getPlatform().openFile(modsDir.toFile())));
    this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getPlatform().openFile(logFile.toFile())));
    if (this.modLoadErrors.isEmpty()) {
        this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> {
            this.minecraft.setScreen(null);
        }));
    } else {
        this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getPlatform().openFile(dumpedLocation.toFile())));
    }
    this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings);
    this.addWidget(this.entryList);
    this.setFocused(this.entryList);
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) Font(net.minecraft.client.gui.Font) ObjectSelectionList(net.minecraft.client.gui.components.ObjectSelectionList) PoseStack(com.mojang.blaze3d.vertex.PoseStack) Strings(com.google.common.base.Strings) Minecraft(net.minecraft.client.Minecraft) ModLoadingWarning(net.minecraftforge.fml.ModLoadingWarning) ChatFormatting(net.minecraft.ChatFormatting) Path(java.nio.file.Path) TranslatableComponent(net.minecraft.network.chat.TranslatableComponent) FMLPaths(net.minecraftforge.fml.loading.FMLPaths) Component(net.minecraft.network.chat.Component) LoadingFailedException(net.minecraftforge.fml.LoadingFailedException) File(java.io.File) Objects(java.util.Objects) Util(net.minecraft.Util) TextComponent(net.minecraft.network.chat.TextComponent) List(java.util.List) Logger(org.apache.logging.log4j.Logger) Paths(java.nio.file.Paths) ErrorScreen(net.minecraft.client.gui.screens.ErrorScreen) FormattedCharSequence(net.minecraft.util.FormattedCharSequence) ForgeI18n(net.minecraftforge.common.ForgeI18n) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) ModLoadingException(net.minecraftforge.fml.ModLoadingException) ExtendedButton(net.minecraftforge.client.gui.widget.ExtendedButton) ExtendedButton(net.minecraftforge.client.gui.widget.ExtendedButton)

Aggregations

Strings (com.google.common.base.Strings)1 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 File (java.io.File)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Collections (java.util.Collections)1 List (java.util.List)1 Objects (java.util.Objects)1 ChatFormatting (net.minecraft.ChatFormatting)1 Util (net.minecraft.Util)1 Minecraft (net.minecraft.client.Minecraft)1 Font (net.minecraft.client.gui.Font)1 ObjectSelectionList (net.minecraft.client.gui.components.ObjectSelectionList)1 ErrorScreen (net.minecraft.client.gui.screens.ErrorScreen)1 Component (net.minecraft.network.chat.Component)1 TextComponent (net.minecraft.network.chat.TextComponent)1 TranslatableComponent (net.minecraft.network.chat.TranslatableComponent)1 FormattedCharSequence (net.minecraft.util.FormattedCharSequence)1 ExtendedButton (net.minecraftforge.client.gui.widget.ExtendedButton)1 ForgeI18n (net.minecraftforge.common.ForgeI18n)1