Search in sources :

Example 6 with Exchange

use of com.almuradev.almura.feature.exchange.Exchange in project Almura by AlmuraDev.

the class ClientExchangeManager method handleForSaleItems.

public void handleForSaleItems(final String id, @Nullable final List<ForSaleItem> forSaleItems, int preLimitCount) {
    checkNotNull(id);
    final Exchange axs = this.getExchange(id);
    if (axs == null) {
        return;
    }
    final GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
    if (currentScreen instanceof ExchangeScreen) {
        if (axs != ((ExchangeScreen) currentScreen).getExchange()) {
            return;
        }
        if (forSaleItems == null) {
            axs.putForSaleItems(null);
        } else {
            axs.putForSaleItems(forSaleItems.stream().collect(Collectors.groupingBy(k -> k.getListItem().getSeller(), ConcurrentHashMap::new, Collectors.toCollection(ArrayList::new))));
        }
        ((ExchangeScreen) currentScreen).refreshForSaleItemResults(forSaleItems, preLimitCount);
    }
}
Also used : Exchange(com.almuradev.almura.feature.exchange.Exchange) GuiScreen(net.minecraft.client.gui.GuiScreen) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ExchangeScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen)

Aggregations

Exchange (com.almuradev.almura.feature.exchange.Exchange)6 ExchangeScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen)4 GuiScreen (net.minecraft.client.gui.GuiScreen)3 BasicForSaleItem (com.almuradev.almura.feature.exchange.basic.listing.BasicForSaleItem)2 BasicListItem (com.almuradev.almura.feature.exchange.basic.listing.BasicListItem)2 ListItem (com.almuradev.almura.feature.exchange.listing.ListItem)2 ClientboundListItemsSaleStatusPacket (com.almuradev.almura.feature.exchange.network.ClientboundListItemsSaleStatusPacket)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Almura (com.almuradev.almura.Almura)1 ExchangeModifyType (com.almuradev.almura.feature.exchange.ExchangeModifyType)1 ExchangeModule (com.almuradev.almura.feature.exchange.ExchangeModule)1 InventoryAction (com.almuradev.almura.feature.exchange.InventoryAction)1 ListStatusType (com.almuradev.almura.feature.exchange.ListStatusType)1 BasicExchange (com.almuradev.almura.feature.exchange.basic.BasicExchange)1 ExchangeManagementScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeManagementScreen)1 ExchangeOfferScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen)1 ForSaleItem (com.almuradev.almura.feature.exchange.listing.ForSaleItem)1 ServerboundExchangeSpecificOfferRequestPacket (com.almuradev.almura.feature.exchange.network.ServerboundExchangeSpecificOfferRequestPacket)1 ServerboundForSaleFilterResponsePacket (com.almuradev.almura.feature.exchange.network.ServerboundForSaleFilterResponsePacket)1 ServerboundListItemsRequestPacket (com.almuradev.almura.feature.exchange.network.ServerboundListItemsRequestPacket)1