use of forestry.api.mail.ITradeStationInfo in project ForestryMC by ForestryMC.
the class ContainerCatalogue method rebuildStationsList.
private void rebuildStationsList() {
stations.clear();
IPostOffice postOffice = PostManager.postRegistry.getPostOffice(player.world);
Map<IMailAddress, ITradeStation> tradeStations = postOffice.getActiveTradeStations(player.world);
for (ITradeStation station : tradeStations.values()) {
ITradeStationInfo info = station.getTradeInfo();
// Filter out any trade stations which do not actually offer anything.
if (FILTERS.get(currentFilter).contains(info.getState())) {
stations.add(station);
}
}
stationIndex = 0;
updateTradeInfo();
}
use of forestry.api.mail.ITradeStationInfo in project ForestryMC by ForestryMC.
the class GuiCatalogue method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case 0:
mc.player.closeScreen();
break;
case // next page
2:
NetworkUtil.sendToServer(new PacketGuiSelectRequest(0, 0));
break;
case // previous page
3:
NetworkUtil.sendToServer(new PacketGuiSelectRequest(1, 0));
break;
case // cycle filter
4:
NetworkUtil.sendToServer(new PacketGuiSelectRequest(2, 0));
break;
case 5:
ITradeStationInfo info = container.getTradeInfo();
if (info != null) {
SessionVars.setStringVar("mail.letter.recipient", info.getAddress().getName());
SessionVars.setStringVar("mail.letter.addressee", EnumAddressee.TRADER.toString());
}
mc.player.closeScreen();
break;
}
}
use of forestry.api.mail.ITradeStationInfo in project ForestryMC by ForestryMC.
the class GuiCatalogue method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
fontRenderer.drawString(String.format("%s / %s", container.getPageNumber(), container.getPageCount()), guiLeft + xSize - 72, guiTop + 12, ColourProperties.INSTANCE.get("gui.book"));
clearTradeInfoWidgets();
ITradeStationInfo tradeInfo = container.getTradeInfo();
if (tradeInfo != null) {
drawTradePreview(tradeInfo, guiLeft + 38, guiTop + 30);
buttonUse.enabled = tradeInfo.getState().isOk();
} else {
drawNoTrade(guiLeft + 38, guiTop + 30);
buttonUse.enabled = false;
}
buttonFilter.displayString = Translator.translateToLocal("for.gui.mail.filter." + container.getFilterIdent());
}
Aggregations