Search in sources :

Example 1 with UIImage

use of net.malisis.core.client.gui.component.decoration.UIImage in project Almura by AlmuraDev.

the class IngameFarmersAlmanac method construct.

// TODO: Translation support
@SuppressWarnings("deprecation")
@Override
public void construct() {
    guiscreenBackground = false;
    final UIFormContainer form = new UIFormContainer(this, formWidth, formHeight, formTitle);
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    form.setMovable(true);
    form.setClosable(false);
    form.setBorder(FontColors.WHITE, 1, formAlpha);
    form.setBackgroundAlpha(formAlpha);
    final WorldClient world = this.client.world;
    final RayTraceResult omo = this.client.objectMouseOver;
    final BlockPos blockPos = omo.getBlockPos();
    final IBlockState blockState = getState(world, blockPos);
    final Block block = blockState.getBlock();
    // Block image
    final ItemStack pickStack = blockState.getBlock().getPickBlock(blockState, omo, this.client.world, omo.getBlockPos(), this.client.player);
    final UIImage blockImage = new UIImage(this, pickStack);
    blockImage.setPosition(leftPad / 2, 0, Anchor.LEFT | Anchor.TOP);
    form.add(blockImage);
    // Localized name
    final UILabel labelLocalizedName = new UILabel(this, block.getLocalizedName());
    labelLocalizedName.setFontOptions(FontColors.WHITE_FO);
    labelLocalizedName.setPosition(SimpleScreen.getPaddedX(blockImage, 4), 0);
    form.add(labelLocalizedName);
    // Registry name
    final String registryName = block.getRegistryName() == null ? "unknown" : block.getRegistryName().toString();
    final UILabel labelRegistryName = new UILabel(this, registryName);
    labelRegistryName.setFontOptions(FontColors.GRAY_FO);
    labelRegistryName.setPosition(labelLocalizedName.getX(), SimpleScreen.getPaddedY(labelLocalizedName, 2));
    form.add(labelRegistryName);
    // Line separator
    final UISeparator separator = new UISeparator(this);
    separator.setSize(form.getWidth() - 15, 1);
    separator.setPosition(0, SimpleScreen.getPaddedY(labelRegistryName, 3), Anchor.TOP | Anchor.CENTER);
    form.add(separator);
    // Property container
    this.propertyContainer = new UIBackgroundContainer(this);
    new UISlimScrollbar(this, this.propertyContainer, UIScrollBar.Type.VERTICAL).setAutoHide(true);
    this.propertyContainer.setBackgroundAlpha(50);
    this.propertyContainer.setPosition(0, SimpleScreen.getPaddedY(separator, 5));
    form.add(this.propertyContainer);
    // Get all displayed properties
    loadProperties(world, blockState, blockPos);
    // Adjust the size of the container to reach at most the specified max height
    propertyContainer.setSize(UIComponent.INHERITED, Math.min(propertyContainerMaxHeight, propertyContainer.getContentHeight()));
    final UIButton closeButton = new UIButtonBuilder(this).text("Close").anchor(Anchor.BOTTOM | Anchor.RIGHT).position(-4, -4).onClick(this::close).build("button.close");
    form.add(closeButton);
    // Adjust the size of the form to better fit content
    form.setSize(form.getContentWidth() + leftPad, form.getContentHeight() + closeButton.getHeight() + 10);
    // Readjust size for width because MalisisCore doesn't account for the scrollbar with UIComponent.INHERITED
    propertyContainer.setSize(propertyContainer.getWidth() - 1, propertyContainer.getHeight());
    addToScreen(form);
    Mouse.setGrabbed(false);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) IBlockState(net.minecraft.block.state.IBlockState) UISlimScrollbar(net.malisis.core.client.gui.component.control.UISlimScrollbar) RayTraceResult(net.minecraft.util.math.RayTraceResult) UIFormContainer(com.almuradev.almura.shared.client.ui.component.UIFormContainer) UISeparator(net.malisis.core.client.gui.component.decoration.UISeparator) WorldClient(net.minecraft.client.multiplayer.WorldClient) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) Block(net.minecraft.block.Block) EnumSkyBlock(net.minecraft.world.EnumSkyBlock) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 2 with UIImage

use of net.malisis.core.client.gui.component.decoration.UIImage in project Almura by AlmuraDev.

the class SimpleAboutMenu method construct.

@SuppressWarnings({ "unchecked" })
@Override
public void construct() {
    super.construct();
    this.list = new UISimpleList(this, 125, UIComponent.INHERITED);
    this.list.setPosition(4, 0);
    this.list.setElementSpacing(4);
    this.list.setUnselect(false);
    final List<AboutListElementData> elementDataList = Lists.newArrayList();
    // Static entry
    elementDataList.add(new AboutListElementData(this.list, new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_MAN), null), 5, 0, 23, 32, 8, AboutConfig.TITLE, AboutConfig.STORY));
    // Dynamic entry
    AboutConfig.ENTRIES.forEach(entry -> {
        Text titles = Text.EMPTY;
        for (String title : entry.titles) {
            titles = titles.toBuilder().append(Text.of("  • ", I18n.format(title)), Text.NEW_LINE).build();
        }
        elementDataList.add(new AboutListElementData(this.list, new UIImage(this, new GuiRemoteTexture(GuiConfig.Location.GENERIC_AVATAR, new ResourceLocation(Almura.ID, "textures/gui/skins/avatars/" + entry.uniqueId + ".png"), String.format(GuiConfig.Url.SKINS, entry.uniqueId, 32), 32, 32), null), 2, 0, 32, 32, 4, Text.of(entry.color, I18n.format(entry.name)), Text.of(TextColors.WHITE, I18n.format(entry.description), Text.NEW_LINE, Text.NEW_LINE, TextStyles.BOLD, I18n.format("almura.menu.about.titles"), TextStyles.RESET, TextColors.RESET, Text.NEW_LINE, titles)));
    });
    final UIButton doneButton = new UIButtonBuilder(this).text(Text.of(I18n.format("gui.done"))).size(98, 20).position(0, -15, 1).anchor(Anchor.BOTTOM | Anchor.CENTER).listener(this).build("button.done");
    this.textField = new UITextField(this, "", true);
    this.textField.setPosition(SimpleScreen.getPaddedX(this.list, 4), 0);
    this.textField.setEditable(false);
    this.textField.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
    this.list.setComponentFactory(AboutListElement::new);
    this.list.setElements(elementDataList);
    this.list.register(this);
    this.list.select(elementDataList.get(0));
    this.getContainer().add(this.list, this.textField);
    // SpongeForge
    final UILabel spongeForgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "SpongeForge: " + ((Optional<String>) Sponge.getPlatform().asMap().get("ImplementationVersion")).orElse("dev"));
    spongeForgeVersionLabel.setPosition(4, -24, Anchor.LEFT | Anchor.BOTTOM);
    // Forge
    final PluginContainer forgeContainer = Sponge.getPluginManager().getPlugin("Forge").orElseThrow(NullPointerException::new);
    final UILabel forgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "Forge: " + forgeContainer.getVersion().orElse("dev"));
    forgeVersionLabel.setPosition(4, -14, Anchor.LEFT | Anchor.BOTTOM);
    addToScreen(forgeVersionLabel);
    // Almura
    final PluginContainer almuraContainer = Sponge.getPluginManager().getPlugin("almura").orElseThrow(NullPointerException::new);
    final UILabel almuraVersionLabel = new UILabel(this, TextFormatting.WHITE + "Almura: " + almuraContainer.getVersion().orElse("dev"));
    almuraVersionLabel.setPosition(4, -4, Anchor.LEFT | Anchor.BOTTOM);
    addToScreen(almuraVersionLabel);
    addToScreen(doneButton);
    addToScreen(spongeForgeVersionLabel);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) PluginContainer(org.spongepowered.api.plugin.PluginContainer) Optional(java.util.Optional) UISimpleList(com.almuradev.almura.shared.client.ui.component.UISimpleList) Text(org.spongepowered.api.text.Text) UITextField(net.malisis.core.client.gui.component.interaction.UITextField) GuiRemoteTexture(com.almuradev.almura.shared.client.texture.GuiRemoteTexture) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage)

Example 3 with UIImage

use of net.malisis.core.client.gui.component.decoration.UIImage in project Almura by AlmuraDev.

the class ServerMenu method construct.

@Override
public void construct() {
    // Create the form
    final UIBackgroundContainer form = new UIBackgroundContainer(this, "", 225, 225);
    // form.setTitle(TextFormatting.WHITE + "Multiplayer");
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    // Create the logo
    logoImage = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    logoImage.setSize(60, 99);
    logoImage.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    liveServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
    liveServerOnline.setPosition(0, getPaddedY(logoImage, padding) + 7, Anchor.TOP | Anchor.CENTER);
    liveServerTitle = new UILabel(this, TextFormatting.WHITE + "Public Server : ");
    liveServerTitle.setPosition(-liveServerTitle.getWidth() / 2 + padding, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
    // Create the live Almura button
    almuraLiveButton = new UIButton(this, "Join ");
    almuraLiveButton.setSize(40, 16);
    almuraLiveButton.setName("button.server.almura.live");
    almuraLiveButton.setPosition(liveServerTitle.getWidth() / 2 + padding, getPaddedY(logoImage, padding) + 3, Anchor.TOP | Anchor.CENTER);
    almuraLiveButton.setVisible(false);
    almuraLiveButton.register(this);
    livePlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
    livePlayersOnline.setPosition(0, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
    livePlayersOnline.setVisible(false);
    devServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
    devServerOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
    devServerTitle = new UILabel(this, TextFormatting.WHITE + "Dev Server : ");
    devServerTitle.setPosition(26, devServerTitle.getY(), Anchor.TOP | Anchor.CENTER);
    // Create the beta Almura button
    almuraDevButton = new UIButton(this, "Join ");
    almuraDevButton.setSize(40, 16);
    almuraDevButton.setName("button.server.almura.dev");
    almuraDevButton.setPosition(devServerOnline.getX() + devServerOnline.getWidth() + 5, getPaddedY(almuraLiveButton, padding) + 3, Anchor.TOP | Anchor.LEFT);
    almuraDevButton.setVisible(false);
    almuraDevButton.register(this);
    devPlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
    devPlayersOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
    devPlayersOnline.setVisible(false);
    centerAlign();
    // Create the join another server button
    UIButton anotherButton = new UIButton(this, "Other Multiplayer");
    anotherButton.setPosition(0, getPaddedY(almuraDevButton, padding) + 13, Anchor.TOP | Anchor.CENTER);
    anotherButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
    anotherButton.setName("button.server.another");
    anotherButton.register(this);
    // Create the back button
    UIButton backButton = new UIButton(this, "Back");
    backButton.setPosition(0, getPaddedY(anotherButton, padding) + 3, Anchor.TOP | Anchor.CENTER);
    backButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
    backButton.setName("button.back");
    backButton.register(this);
    final UIButton forumsButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(-padding, -padding).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu.forums"))).build("button.forums");
    final UIButton issuesButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_GITHUB).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, padding, Anchor.RIGHT), forumsButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format(I18n.format("almura.menu.issues")))).build("button.issues");
    final UIButton shopButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(issuesButton, padding, Anchor.RIGHT), issuesButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu.shop"))).build("button.shop");
    final UILabel trademarkLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.trademark"));
    trademarkLabel.setPosition(padding, -padding, Anchor.BOTTOM | Anchor.LEFT);
    final UILabel copyrightLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.copyright"));
    copyrightLabel.setPosition(trademarkLabel.getX(), SimpleScreen.getPaddedY(trademarkLabel, padding, Anchor.BOTTOM), trademarkLabel.getAnchor());
    form.add(logoImage, liveServerTitle, liveServerOnline, almuraLiveButton, devServerTitle, devServerOnline, almuraDevButton, devPlayersOnline, livePlayersOnline, anotherButton, backButton);
    form.setColor(Integer.MIN_VALUE);
    form.setBackgroundAlpha(0);
    addToScreen(form, forumsButton, issuesButton, shopButton, trademarkLabel, copyrightLabel);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 4 with UIImage

use of net.malisis.core.client.gui.component.decoration.UIImage in project Almura by AlmuraDev.

the class SimpleIngameMenu method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    final UIBackgroundContainer contentContainer = new UIBackgroundContainer(this);
    contentContainer.setBackgroundAlpha(0);
    contentContainer.setSize(220, 202);
    contentContainer.setAnchor(Anchor.MIDDLE | Anchor.CENTER);
    // Almura Header
    final UIImage almuraHeader = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    almuraHeader.setSize(60, 99);
    almuraHeader.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    final UIButton backButton = new UIButtonBuilder(this).text(I18n.format("menu.returnToGame")).size(220, 20).position(0, SimpleScreen.getPaddedY(almuraHeader, 10)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).container(contentContainer).build("button.back");
    final UIBackgroundContainer shortcutContainer = new UIBackgroundContainer(this);
    shortcutContainer.setBackgroundAlpha(0);
    shortcutContainer.setSize(220, 24);
    shortcutContainer.setPosition(backButton.getX(), SimpleScreen.getPaddedY(backButton, PADDING));
    shortcutContainer.setAnchor(Anchor.TOP | Anchor.CENTER);
    final boolean lanAvaiable = Minecraft.getMinecraft().isSingleplayer() && !Minecraft.getMinecraft().getIntegratedServer().getPublic();
    final boolean guideAvailable = Sponge.getPluginManager().getPlugin("guide").isPresent();
    final UIButton shopButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.shop"))).build("button.shop");
    final UIButton guideButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_BOOK).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(shopButton, PADDING), shopButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.guide"))).enabled(guideAvailable).build("button.guide");
    final UIButton mapButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_MAP).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(guideButton, PADDING), guideButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("item.map.name"))).build("button.instance");
    final UIButton statisticsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_PIE_CHART).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(mapButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("gui.stats"))).build("button.statistics");
    final UIButton advancementsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_TROPHY).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(statisticsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of("gui.advancements")).build("button.advancements");
    final UIButton forumsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(advancementsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.forums"))).build("button.forums");
    final UIButton lanButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SITEMAP).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("menu.shareToLan"))).enabled(lanAvaiable).build("button.lan");
    final UIButton optionsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_COG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(lanButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("menu.options"))).build("button.options");
    final UIButton quitButton = new UIButtonBuilder(this).container(contentContainer).text(Text.of(I18n.format("almura.menu_button.quit"))).fro(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).hoverFro(FontOptions.builder().color(Color.ofRgb(255, 89, 89).getRgb()).shadow(true).build()).size(GuiConfig.Button.WIDTH_SHORT, GuiConfig.Button.HEIGHT).position(0, SimpleScreen.getPaddedY(shortcutContainer, 25)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.quit");
    contentContainer.add(almuraHeader, shortcutContainer);
    this.addToScreen(contentContainer);
}
Also used : GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 5 with UIImage

use of net.malisis.core.client.gui.component.decoration.UIImage in project Almura by AlmuraDev.

the class PanoramicMainMenu method construct.

@SuppressWarnings("deprecation")
@Override
public void construct() {
    final UIBackgroundContainer container = new UIBackgroundContainer(this);
    container.setBackgroundAlpha(0);
    container.setPosition(0, -10, Anchor.MIDDLE | Anchor.CENTER);
    container.setSize(GuiConfig.Button.WIDTH_LONG, 205);
    // Almura header
    final UIImage almuraHeader = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    almuraHeader.setSize(60, 99);
    almuraHeader.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    this.buttonContainer = new UIBackgroundContainer(this, GuiConfig.Button.WIDTH_LONG + PADDING, (GuiConfig.Button.HEIGHT * 4) + (PADDING * 3));
    this.buttonContainer.setPosition(0, SimpleScreen.getPaddedY(almuraHeader, 10), Anchor.TOP | Anchor.CENTER);
    this.buttonContainer.setBackgroundAlpha(0);
    final UIButton singleplayerButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("menu.singleplayer"))).size(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT).position(0, 0).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.singleplayer");
    final UIButton multiplayerButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("menu.multiplayer"))).size(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT).position(0, SimpleScreen.getPaddedY(singleplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.multiplayer");
    final UIButton optionsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("options.title"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(-68, SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.options");
    final UIButton modsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("almura.menu_button.mods"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(SimpleScreen.getPaddedX(optionsButton, PADDING), SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.mods");
    final UIButton aboutButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("almura.menu_button.about"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(SimpleScreen.getPaddedX(modsButton, PADDING), SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.about");
    final UIButton quitButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("almura.menu_button.quit"))).fro(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).hoverFro(FontOptions.builder().color(Color.ofRgb(255, 89, 89).getRgb()).shadow(true).build()).size(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT).position(singleplayerButton.getX(), SimpleScreen.getPaddedY(optionsButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.quit");
    final UIButton forumsButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(-PADDING, -PADDING).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.forums"))).build("button.forums");
    final UIButton issuesButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_GITHUB).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, PADDING, Anchor.RIGHT), forumsButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format(I18n.format("almura.menu_button.issues")))).build("button.issues");
    final UIButton shopButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(issuesButton, PADDING, Anchor.RIGHT), issuesButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.shop"))).build("button.shop");
    final UILabel trademarkLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.trademark"));
    trademarkLabel.setPosition(PADDING, -PADDING, Anchor.BOTTOM | Anchor.LEFT);
    final UILabel copyrightLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.copyright"));
    copyrightLabel.setPosition(trademarkLabel.getX(), SimpleScreen.getPaddedY(trademarkLabel, PADDING, Anchor.BOTTOM), trademarkLabel.getAnchor());
    container.add(almuraHeader, this.buttonContainer);
    // Disable escape key press
    registerKeyListener((keyChar, keyCode) -> keyCode == Keyboard.KEY_ESCAPE);
    // Add content to screen
    addToScreen(container);
    addToScreen(trademarkLabel);
    addToScreen(copyrightLabel);
    addToScreen(shopButton);
    addToScreen(forumsButton);
    addToScreen(issuesButton);
    // OpenGL Warning
    if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) {
        final UILabel glWarning1 = new UILabel(this, TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(TextStyles.BOLD, TextColors.DARK_RED, I18n.format("almura.menu.main.opengl.0"))));
        glWarning1.setPosition(2, 2, Anchor.TOP | Anchor.LEFT);
        final UILabel glWarning2 = new UILabel(this, TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(TextStyles.BOLD, TextColors.DARK_RED, I18n.format("almura.menu.main.opengl.1"))));
        glWarning2.setPosition(2, SimpleScreen.getPaddedY(glWarning1, 2), Anchor.TOP | Anchor.LEFT);
        addToScreen(glWarning1);
        addToScreen(glWarning2);
    }
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Aggregations

UIButtonBuilder (com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder)5 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)5 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)5 GuiTexture (net.malisis.core.client.gui.GuiTexture)4 UIBackgroundContainer (net.malisis.core.client.gui.component.container.UIBackgroundContainer)4 UILabel (net.malisis.core.client.gui.component.decoration.UILabel)4 GuiRemoteTexture (com.almuradev.almura.shared.client.texture.GuiRemoteTexture)1 UIFormContainer (com.almuradev.almura.shared.client.ui.component.UIFormContainer)1 UISimpleList (com.almuradev.almura.shared.client.ui.component.UISimpleList)1 Optional (java.util.Optional)1 UISlimScrollbar (net.malisis.core.client.gui.component.control.UISlimScrollbar)1 UISeparator (net.malisis.core.client.gui.component.decoration.UISeparator)1 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 WorldClient (net.minecraft.client.multiplayer.WorldClient)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1