Search in sources :

Example 1 with WindowRequestDetail

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

the class RequestBasedInteraction method onClientResponseTriggered.

@Override
@OnlyIn(Dist.CLIENT)
public boolean onClientResponseTriggered(final ITextComponent response, final PlayerEntity player, final ICitizenDataView data, final Window window) {
    if (response.equals(new TranslationTextComponent("com.minecolonies.coremod.gui.chat.fulfill"))) {
        final IColony colony = IColonyManager.getInstance().getColonyView(data.getColonyId(), player.level.dimension());
        if (colony != null) {
            final IRequest<?> request = colony.getRequestManager().getRequestForToken(token);
            if (request != null) {
                final RequestWindowCitizen windowCitizen = new RequestWindowCitizen(data);
                windowCitizen.open();
                final WindowRequestDetail windowRequestDetail = new WindowRequestDetail(windowCitizen, request, data.getColonyId());
                windowRequestDetail.open();
                return false;
            }
        }
    } else {
        return super.onClientResponseTriggered(response, player, data, window);
    }
    return true;
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) WindowRequestDetail(com.minecolonies.coremod.client.gui.WindowRequestDetail) RequestWindowCitizen(com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with WindowRequestDetail

use of com.minecolonies.coremod.client.gui.WindowRequestDetail in project minecolonies by Minecolonies.

the class RequestBasedInteraction method onClientResponseTriggered.

@Override
@OnlyIn(Dist.CLIENT)
public boolean onClientResponseTriggered(final ITextComponent response, final PlayerEntity player, final ICitizenDataView data, final Window window) {
    if (response.equals(new TranslationTextComponent("com.minecolonies.coremod.gui.chat.fulfill"))) {
        final IColony colony = IColonyManager.getInstance().getColonyView(data.getColonyId(), player.level.dimension());
        if (colony != null) {
            final IRequest<?> request = colony.getRequestManager().getRequestForToken(token);
            if (request != null) {
                final RequestWindowCitizen windowCitizen = new RequestWindowCitizen(data);
                windowCitizen.open();
                final WindowRequestDetail windowRequestDetail = new WindowRequestDetail(windowCitizen, request, data.getColonyId());
                windowRequestDetail.open();
                return false;
            }
        }
    } else {
        return super.onClientResponseTriggered(response, player, data, window);
    }
    return true;
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) WindowRequestDetail(com.minecolonies.coremod.client.gui.WindowRequestDetail) RequestWindowCitizen(com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

WindowRequestDetail (com.minecolonies.coremod.client.gui.WindowRequestDetail)2 RequestWindowCitizen (com.minecolonies.coremod.client.gui.citizen.RequestWindowCitizen)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2