Search in sources :

Example 1 with MarkBuildingDirtyMessage

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

the class WarehouseOptionsModuleWindow method onOpened.

@Override
public void onOpened() {
    if (buildingView.getBuildingLevel() < BUILDING_LEVEL_FOR_SORTING) {
        final ButtonImage sortButton = findPaneOfTypeByID(SORT_WAREHOUSE_BUTTON, ButtonImage.class);
        PaneBuilders.tooltipBuilder().append(new TranslationTextComponent("com.minecolonies.coremod.gui.warehouse.sort.disabled.1", BUILDING_LEVEL_FOR_SORTING)).appendNL(new TranslationTextComponent("com.minecolonies.coremod.gui.warehouse.sort.disabled.2", BUILDING_LEVEL_FOR_SORTING)).hoverPane(sortButton).build();
        sortButton.disable();
    }
    super.onOpened();
    updateResourcePane();
    // Make sure we have a fresh view
    Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(this.buildingView));
}
Also used : ButtonImage(com.ldtteam.blockout.controls.ButtonImage) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) MarkBuildingDirtyMessage(com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)

Example 2 with MarkBuildingDirtyMessage

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

the class WindowBuilderResModule method onOpened.

@Override
public void onOpened() {
    super.onOpened();
    pullResourcesFromHut();
    final ScrollingList resourceList = findPaneOfTypeByID(LIST_RESOURCES, ScrollingList.class);
    resourceList.setDataProvider(new ScrollingList.DataProvider() {

        @Override
        public int getElementCount() {
            return resources.size();
        }

        @Override
        public void updateElement(final int index, @NotNull final Pane rowPane) {
            updateResourcePane(index, rowPane);
        }
    });
    // Make sure we have a fresh view
    Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(this.buildingView));
    findPaneOfTypeByID(LABEL_CONSTRUCTION_NAME, Text.class).setText(moduleView.getConstructionName());
    findPaneOfTypeByID(STEP_PROGRESS, Text.class).setText(new TranslationTextComponent("com.minecolonies.coremod.gui.progress.step", moduleView.getCurrentStage(), moduleView.getTotalStages()));
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Text(com.ldtteam.blockout.controls.Text) ScrollingList(com.ldtteam.blockout.views.ScrollingList) Pane(com.ldtteam.blockout.Pane) MarkBuildingDirtyMessage(com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)

Example 3 with MarkBuildingDirtyMessage

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

the class WindowResourceList method onOpened.

@Override
public void onOpened() {
    final ClientPlayerEntity player = Minecraft.getInstance().player;
    if (this.builder == null) {
        player.sendMessage(new TranslationTextComponent("com.minecolonies.coremod.resourcescroll.nobuilder"), player.getUUID());
        close();
        return;
    }
    super.onOpened();
    pullResourcesFromHut();
    final ScrollingList resourceList = findPaneOfTypeByID(LIST_RESOURCES, ScrollingList.class);
    if (resourceList == null) {
        player.sendMessage(new TranslationTextComponent("com.minecolonies.coremod.resourcescroll.null"), player.getUUID());
        close();
        return;
    }
    resourceList.setDataProvider(new ScrollingList.DataProvider() {

        @Override
        public int getElementCount() {
            return resources.size();
        }

        @Override
        public void updateElement(final int index, @NotNull final Pane rowPane) {
            updateResourcePane(index, rowPane);
        }
    });
    final BuildingResourcesModuleView moduleView = builder.getModuleView(BuildingResourcesModuleView.class);
    // Make sure we have a fresh view
    Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(builder));
    findPaneOfTypeByID(LABEL_WORKERNAME, Text.class).setText(builder.getWorkerName());
    findPaneOfTypeByID(LABEL_CONSTRUCTION_NAME, Text.class).setText(moduleView.getConstructionName());
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Text(com.ldtteam.blockout.controls.Text) ClientPlayerEntity(net.minecraft.client.entity.player.ClientPlayerEntity) ScrollingList(com.ldtteam.blockout.views.ScrollingList) Pane(com.ldtteam.blockout.Pane) BuildingResourcesModuleView(com.minecolonies.coremod.colony.buildings.moduleviews.BuildingResourcesModuleView) MarkBuildingDirtyMessage(com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)

Example 4 with MarkBuildingDirtyMessage

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

the class WarehouseOptionsModuleWindow method onOpened.

@Override
public void onOpened() {
    if (buildingView.getBuildingLevel() < BUILDING_LEVEL_FOR_SORTING) {
        final ButtonImage sortButton = findPaneOfTypeByID(SORT_WAREHOUSE_BUTTON, ButtonImage.class);
        PaneBuilders.tooltipBuilder().append(new TranslationTextComponent("com.minecolonies.coremod.gui.warehouse.sort.disabled.1", BUILDING_LEVEL_FOR_SORTING)).appendNL(new TranslationTextComponent("com.minecolonies.coremod.gui.warehouse.sort.disabled.2", BUILDING_LEVEL_FOR_SORTING)).hoverPane(sortButton).build();
        sortButton.disable();
    }
    super.onOpened();
    updateResourcePane();
    // Make sure we have a fresh view
    Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(this.buildingView));
}
Also used : ButtonImage(com.ldtteam.blockout.controls.ButtonImage) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) MarkBuildingDirtyMessage(com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)

Example 5 with MarkBuildingDirtyMessage

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

the class WindowResourceList method onOpened.

@Override
public void onOpened() {
    final ClientPlayerEntity player = Minecraft.getInstance().player;
    if (this.builder == null) {
        player.sendMessage(new TranslationTextComponent("com.minecolonies.coremod.resourcescroll.nobuilder"), player.getUUID());
        close();
        return;
    }
    super.onOpened();
    pullResourcesFromHut();
    final ScrollingList resourceList = findPaneOfTypeByID(LIST_RESOURCES, ScrollingList.class);
    if (resourceList == null) {
        player.sendMessage(new TranslationTextComponent("com.minecolonies.coremod.resourcescroll.null"), player.getUUID());
        close();
        return;
    }
    resourceList.setDataProvider(new ScrollingList.DataProvider() {

        @Override
        public int getElementCount() {
            return resources.size();
        }

        @Override
        public void updateElement(final int index, @NotNull final Pane rowPane) {
            updateResourcePane(index, rowPane);
        }
    });
    final BuildingResourcesModuleView moduleView = builder.getModuleView(BuildingResourcesModuleView.class);
    // Make sure we have a fresh view
    Network.getNetwork().sendToServer(new MarkBuildingDirtyMessage(builder));
    findPaneOfTypeByID(LABEL_WORKERNAME, Text.class).setText(builder.getWorkerName());
    findPaneOfTypeByID(LABEL_CONSTRUCTION_NAME, Text.class).setText(moduleView.getConstructionName());
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Text(com.ldtteam.blockout.controls.Text) ClientPlayerEntity(net.minecraft.client.entity.player.ClientPlayerEntity) ScrollingList(com.ldtteam.blockout.views.ScrollingList) Pane(com.ldtteam.blockout.Pane) BuildingResourcesModuleView(com.minecolonies.coremod.colony.buildings.moduleviews.BuildingResourcesModuleView) MarkBuildingDirtyMessage(com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)

Aggregations

MarkBuildingDirtyMessage (com.minecolonies.coremod.network.messages.server.colony.building.MarkBuildingDirtyMessage)6 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)6 Pane (com.ldtteam.blockout.Pane)4 Text (com.ldtteam.blockout.controls.Text)4 ScrollingList (com.ldtteam.blockout.views.ScrollingList)4 ButtonImage (com.ldtteam.blockout.controls.ButtonImage)2 BuildingResourcesModuleView (com.minecolonies.coremod.colony.buildings.moduleviews.BuildingResourcesModuleView)2 ClientPlayerEntity (net.minecraft.client.entity.player.ClientPlayerEntity)2