Search in sources :

Example 6 with ItemIcon

use of com.ldtteam.blockout.controls.ItemIcon in project minecolonies by ldtteam.

the class RecruitmentInteraction method onWindowOpened.

@Override
@OnlyIn(Dist.CLIENT)
public void onWindowOpened(final Window window, final ICitizenDataView dataView) {
    final ButtonImage recruitButton = window.findPaneOfTypeByID(BUTTON_RESPONSE_ID + 2, ButtonImage.class);
    final Box group = window.findPaneOfTypeByID(RESPONSE_BOX_ID, Box.class);
    if (recruitButton != null && dataView instanceof IVisitorViewData) {
        final ItemStack recruitCost = ((IVisitorViewData) dataView).getRecruitCost();
        final IColonyView colony = ((IVisitorViewData) dataView).getColonyView();
        window.findPaneOfTypeByID(CHAT_LABEL_ID, Text.class).setText(PaneBuilders.textBuilder().append(new StringTextComponent(dataView.getName() + ": ")).append(this.getInquiry()).emptyLines(1).append(new TranslationTextComponent(colony.getCitizens().size() < colony.getCitizenCountLimit() ? "com.minecolonies.coremod.gui.chat.recruitcost" : "com.minecolonies.coremod.gui.chat.nospacerecruit", dataView.getName().split(" ")[0], recruitCost.getCount() + " " + recruitCost.getHoverName().getString())).getText());
        int iconPosX = recruitButton.getX() + recruitButton.getWidth() - 28;
        int iconPosY = recruitButton.getY() + recruitButton.getHeight() - 18;
        ItemIcon icon = new ItemIcon();
        icon.setID(RECRUITMENT_ICON);
        icon.setSize(15, 15);
        group.addChild(icon);
        icon.setItem(((IVisitorViewData) dataView).getRecruitCost());
        icon.setPosition(iconPosX, iconPosY);
        icon.setVisible(true);
    }
}
Also used : ButtonImage(com.ldtteam.blockout.controls.ButtonImage) ItemIcon(com.ldtteam.blockout.controls.ItemIcon) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Box(com.ldtteam.blockout.views.Box) Text(com.ldtteam.blockout.controls.Text) StringTextComponent(net.minecraft.util.text.StringTextComponent) ItemStack(net.minecraft.item.ItemStack) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

ItemIcon (com.ldtteam.blockout.controls.ItemIcon)6 ButtonImage (com.ldtteam.blockout.controls.ButtonImage)4 Text (com.ldtteam.blockout.controls.Text)4 ItemStack (net.minecraft.item.ItemStack)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4 Box (com.ldtteam.blockout.views.Box)2 ScrollingList (com.ldtteam.blockout.views.ScrollingList)2 View (com.ldtteam.blockout.views.View)2 ILocation (com.minecolonies.api.colony.requestsystem.location.ILocation)2 AbstractBuildingGuards (com.minecolonies.coremod.colony.buildings.AbstractBuildingGuards)2 Pair (com.mojang.datafixers.util.Pair)2 StringTextComponent (net.minecraft.util.text.StringTextComponent)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)2