Search in sources :

Example 1 with ExchangeOfferScreen

use of com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen in project Almura by AlmuraDev.

the class ClientExchangeManager method handleExchangeSpecificOffer.

public void handleExchangeSpecificOffer(final String id) {
    checkNotNull(id);
    final GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
    if (!(currentScreen instanceof ExchangeScreen)) {
        return;
    }
    final Exchange axs = this.getExchange(id);
    if (axs == null) {
        ((ExchangeScreen) currentScreen).close();
        return;
    }
    final ExchangeScreen axsScreen = (ExchangeScreen) currentScreen;
    new ExchangeOfferScreen(axsScreen, axs, axsScreen.listItemList.getItems().stream().filter(item -> !item.getForSaleItem().isPresent()).map(item -> new BasicVanillaStack(item.asRealStack())).collect(Collectors.toList()), axsScreen.limit).display();
}
Also used : Exchange(com.almuradev.almura.feature.exchange.Exchange) ExchangeModifyType(com.almuradev.almura.feature.exchange.ExchangeModifyType) FMLNetworkEvent(net.minecraftforge.fml.common.network.FMLNetworkEvent) Almura(com.almuradev.almura.Almura) ClientboundListItemsSaleStatusPacket(com.almuradev.almura.feature.exchange.network.ClientboundListItemsSaleStatusPacket) ServerboundModifyForSaleItemListStatusRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundModifyForSaleItemListStatusRequestPacket) ServerboundTransactionRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundTransactionRequestPacket) ListStatusType(com.almuradev.almura.feature.exchange.ListStatusType) Singleton(javax.inject.Singleton) ForSaleItem(com.almuradev.almura.feature.exchange.listing.ForSaleItem) ListItem(com.almuradev.almura.feature.exchange.listing.ListItem) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) BigDecimal(java.math.BigDecimal) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) BasicForSaleItem(com.almuradev.almura.feature.exchange.basic.listing.BasicForSaleItem) ExchangeModule(com.almuradev.almura.feature.exchange.ExchangeModule) ServerboundModifyExchangePacket(com.almuradev.almura.feature.exchange.network.ServerboundModifyExchangePacket) ExchangeOfferScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen) ExchangeScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen) BasicListItem(com.almuradev.almura.feature.exchange.basic.listing.BasicListItem) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nullable(javax.annotation.Nullable) Exchange(com.almuradev.almura.feature.exchange.Exchange) ExchangeManagementScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeManagementScreen) SoundEvents(net.minecraft.init.SoundEvents) ServerboundListItemsRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundListItemsRequestPacket) InventoryAction(com.almuradev.almura.feature.exchange.InventoryAction) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) ServerboundForSaleFilterResponsePacket(com.almuradev.almura.feature.exchange.network.ServerboundForSaleFilterResponsePacket) FeatureConstants(com.almuradev.almura.shared.feature.FeatureConstants) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) NetworkConfig(com.almuradev.almura.shared.network.NetworkConfig) BasicVanillaStack(com.almuradev.almura.shared.item.BasicVanillaStack) Collectors(java.util.stream.Collectors) Preconditions.checkState(com.google.common.base.Preconditions.checkState) ChannelBinding(org.spongepowered.api.network.ChannelBinding) GuiScreen(net.minecraft.client.gui.GuiScreen) List(java.util.List) Witness(com.almuradev.core.event.Witness) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) ChannelId(org.spongepowered.api.network.ChannelId) ServerboundExchangeSpecificOfferRequestPacket(com.almuradev.almura.feature.exchange.network.ServerboundExchangeSpecificOfferRequestPacket) ExchangeOfferScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen) GuiScreen(net.minecraft.client.gui.GuiScreen) BasicVanillaStack(com.almuradev.almura.shared.item.BasicVanillaStack) ExchangeScreen(com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen)

Aggregations

Almura (com.almuradev.almura.Almura)1 Exchange (com.almuradev.almura.feature.exchange.Exchange)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 BasicForSaleItem (com.almuradev.almura.feature.exchange.basic.listing.BasicForSaleItem)1 BasicListItem (com.almuradev.almura.feature.exchange.basic.listing.BasicListItem)1 ExchangeManagementScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeManagementScreen)1 ExchangeOfferScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeOfferScreen)1 ExchangeScreen (com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen)1 ForSaleItem (com.almuradev.almura.feature.exchange.listing.ForSaleItem)1 ListItem (com.almuradev.almura.feature.exchange.listing.ListItem)1 ClientboundListItemsSaleStatusPacket (com.almuradev.almura.feature.exchange.network.ClientboundListItemsSaleStatusPacket)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 ServerboundModifyExchangePacket (com.almuradev.almura.feature.exchange.network.ServerboundModifyExchangePacket)1 ServerboundModifyForSaleItemListStatusRequestPacket (com.almuradev.almura.feature.exchange.network.ServerboundModifyForSaleItemListStatusRequestPacket)1 ServerboundTransactionRequestPacket (com.almuradev.almura.feature.exchange.network.ServerboundTransactionRequestPacket)1