Search in sources :

Example 6 with RequestWindowCitizen

use of com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen in project minecolonies by ldtteam.

the class WindowRequestDetail method onButtonClicked.

/**
 * Called when any button has been clicked.
 *
 * @param button the clicked button.
 */
@Override
public void onButtonClicked(@NotNull final Button button) {
    if (button.getID().equals(REQUEST_FULLFIL)) {
        if (this.prevWindow instanceof RequestWindowCitizen) {
            ((RequestWindowCitizen) this.prevWindow).fulfill(request);
            // because this isn't an AbstractWindowSkeleton, and we want to trigger an advancement...
            Network.getNetwork().sendToServer(new ClickGuiButtonTriggerMessage(button.getID(), Constants.MOD_ID + CITIZEN_REQ_DETAIL_SUFFIX));
        }
        this.window.close();
    } else if (button.getID().equals(REQUEST_CANCEL)) {
        if (this.prevWindow instanceof RequestWindowCitizen) {
            ((RequestWindowCitizen) this.prevWindow).cancel(request);
        }
        this.window.close();
    } else {
        prevWindow.open();
    }
}
Also used : ClickGuiButtonTriggerMessage(com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage) RequestWindowCitizen(com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)

Aggregations

RequestWindowCitizen (com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)6 Pane (com.ldtteam.blockout.Pane)2 Box (com.ldtteam.blockout.views.Box)2 IColonyView (com.minecolonies.api.colony.IColonyView)2 WindowRequestDetail (com.minecolonies.coremod.client.gui.WindowRequestDetail)2 ClickGuiButtonTriggerMessage (com.minecolonies.coremod.network.messages.server.ClickGuiButtonTriggerMessage)2 ItemStack (net.minecraft.item.ItemStack)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2