Search in sources :

Example 1 with BuildRequestMessage

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

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 2 with BuildRequestMessage

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

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)

Example 3 with BuildRequestMessage

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

the class WindowBuildBuilding method deconstructBuildingClicked.

/**
 * When the deconstruct building button has been clicked.
 */
private void deconstructBuildingClicked() {
    final BlockPos builder = buildersDropDownList.getSelectedIndex() == 0 ? BlockPos.ZERO : builders.get(buildersDropDownList.getSelectedIndex()).getB();
    Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REMOVE, builder));
    cancelClicked();
}
Also used : BuildRequestMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage) BlockPos(net.minecraft.util.math.BlockPos)

Example 4 with BuildRequestMessage

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

the class WindowBuildBuilding method deconstructBuildingClicked.

/**
 * When the deconstruct building button has been clicked.
 */
private void deconstructBuildingClicked() {
    final BlockPos builder = buildersDropDownList.getSelectedIndex() == 0 ? BlockPos.ZERO : builders.get(buildersDropDownList.getSelectedIndex()).getB();
    Network.getNetwork().sendToServer(new BuildRequestMessage(building, BuildRequestMessage.Mode.REMOVE, builder));
    cancelClicked();
}
Also used : BuildRequestMessage(com.minecolonies.coremod.network.messages.server.colony.building.BuildRequestMessage) BlockPos(net.minecraft.util.math.BlockPos)

Example 5 with BuildRequestMessage

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

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)

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