use of com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen 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();
}
use of com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen 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);
}
}
use of com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen in project Almura by AlmuraDev.
the class ClientExchangeManager method handleExchangeSpecific.
public void handleExchangeSpecific(final String id, final int limit) {
checkState(limit >= FeatureConstants.UNLIMITED);
final Exchange axs = this.getExchange(id);
if (axs != null) {
this.clearFilterCache();
new ExchangeScreen(axs, limit).display();
}
}
use of com.almuradev.almura.feature.exchange.client.gui.ExchangeScreen in project Almura by AlmuraDev.
the class ClientExchangeManager method handleListItems.
public void handleListItems(final String id, @Nullable final List<ListItem> listItems) {
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;
}
axs.putListItemsFor(Minecraft.getMinecraft().player.getUniqueID(), listItems);
((ExchangeScreen) currentScreen).refreshListItems();
}
}
Aggregations