use of com.minecolonies.coremod.network.messages.ChangeRecipePriorityMessage in project minecolonies by Minecolonies.
the class WindowListRecipes method onButtonClicked.
/**
* Called when any button has been clicked.
*
* @param button the clicked button.
*/
@Override
public void onButtonClicked(@NotNull final Button button) {
final int row = recipeList.getListElementIndexByPane(button) - 1;
if (button.getID().equals(BUTTON_REMOVE)) {
final IRecipeStorage data = recipes.get(row + 1);
building.removeRecipe(row + 1);
MineColonies.getNetwork().sendToServer(new AddRemoveRecipeMessage(data, building, true));
} else if (button.getID().equals(BUTTON_UP)) {
building.switchIndex(row, row + 1);
MineColonies.getNetwork().sendToServer(new ChangeRecipePriorityMessage(building, row, true));
} else if (button.getID().equals(BUTTON_DOWN)) {
building.switchIndex(row, row - 1);
MineColonies.getNetwork().sendToServer(new ChangeRecipePriorityMessage(building, row, false));
} else if (button.getID().equals(BUTTON_CANCEL)) {
building.openGui(false);
}
}
Aggregations