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);
}
}
Aggregations