Search in sources :

Example 6 with BuildRequestMessage

use of com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage in project minecolonies by ldtteam.

the class WindowBuildBuilding method confirmClicked.

/**
 * On confirm button.
 */
private void confirmClicked() {
    final BlockPos builder = buildersDropDownList.getSelectedIndex() == 0 ? BlockPos.ZERO : builders.get(buildersDropDownList.getSelectedIndex()).getB();
    Network.getNetwork().sendToServer(new BuildingSetStyleMessage(building, styles.get(stylesDropDownList.getSelectedIndex())));
    if (building.getBuildingLevel() == building.getBuildingMaxLevel()) {
        Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REPAIR, builder));
    } else {
        Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.BUILD, builder));
    }
    cancelClicked();
}
Also used : BuildRequestMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage) BlockPos(net.minecraft.util.math.BlockPos) BuildingSetStyleMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildingSetStyleMessage)

Example 7 with BuildRequestMessage

use of com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage in project minecolonies by ldtteam.

the class WindowBuildBuilding method repairClicked.

/**
 * Action when repair button is clicked.
 */
private void repairClicked() {
    final BlockPos builder = buildersDropDownList.getSelectedIndex() == 0 ? BlockPos.ZERO : builders.get(buildersDropDownList.getSelectedIndex()).getB();
    Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REPAIR, builder));
    cancelClicked();
}
Also used : BuildRequestMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage) BlockPos(net.minecraft.util.math.BlockPos)

Example 8 with BuildRequestMessage

use of com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage in project minecolonies by ldtteam.

the class AbstractWindowModuleBuilding method buildClicked.

/**
 * Action when build button is clicked.
 */
private void buildClicked() {
    final String buttonLabel = buttonBuild.getTextAsString();
    if (buttonLabel.equalsIgnoreCase(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.cancelbuild")) || buttonLabel.equalsIgnoreCase(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.cancelupgrade"))) {
        Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.BUILD, BlockPos.ZERO));
    } else if (buttonLabel.equalsIgnoreCase(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.cancelrepair"))) {
        Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REPAIR, BlockPos.ZERO));
    } else if (buttonLabel.equalsIgnoreCase(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.canceldeconstruction"))) {
        Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REMOVE, BlockPos.ZERO));
    } else {
        @NotNull final WindowBuildBuilding window = new WindowBuildBuilding(building.getColony(), building);
        window.open();
    }
}
Also used : BuildRequestMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BuildRequestMessage (com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage)8 BlockPos (net.minecraft.util.math.BlockPos)6 BuildingSetStyleMessage (com.minecolonies.coremod.network.messages.server.colony.building.BuildingSetStyleMessage)2 NotNull (org.jetbrains.annotations.NotNull)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)1