Search in sources :

Example 6 with IWorkOrderView

use of com.minecolonies.api.colony.workorders.IWorkOrderView in project minecolonies by Minecolonies.

the class ColonyView method handleColonyViewWorkOrderMessage.

/**
 * Update a ColonyView's workOrders given a network data ColonyView update packet. This uses a full-replacement - workOrders do not get updated and are instead overwritten.
 *
 * @param buf Network data.
 * @return null == no response.
 */
@Override
@Nullable
public IMessage handleColonyViewWorkOrderMessage(final PacketBuffer buf) {
    workOrders.clear();
    final int amount = buf.readInt();
    for (int i = 0; i < amount; i++) {
        @Nullable final IWorkOrderView workOrder = AbstractWorkOrder.createWorkOrderView(buf);
        if (workOrder != null) {
            workOrders.put(workOrder.getId(), workOrder);
        }
    }
    return null;
}
Also used : IWorkOrderView(com.minecolonies.api.colony.workorders.IWorkOrderView) Nullable(org.jetbrains.annotations.Nullable) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IWorkOrderView (com.minecolonies.api.colony.workorders.IWorkOrderView)6 Text (com.ldtteam.blockout.controls.Text)2 ScrollingList (com.ldtteam.blockout.views.ScrollingList)2 WorkOrderChangeMessage (com.minecolonies.coremod.network.messages.server.colony.WorkOrderChangeMessage)2 Pane (com.ldtteam.blockout.Pane)1 Button (com.ldtteam.blockout.controls.Button)1 ButtonImage (com.ldtteam.blockout.controls.ButtonImage)1 IBuildingView (com.minecolonies.api.colony.buildings.views.IBuildingView)1 AbstractBuildingBuilderView (com.minecolonies.coremod.colony.buildings.views.AbstractBuildingBuilderView)1 WorkOrderMinerView (com.minecolonies.coremod.colony.workorders.view.WorkOrderMinerView)1 BuilderSelectWorkOrderMessage (com.minecolonies.coremod.network.messages.server.colony.building.builder.BuilderSelectWorkOrderMessage)1 StringTextComponent (net.minecraft.util.text.StringTextComponent)1 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)1 Nullable (org.jetbrains.annotations.Nullable)1