Search in sources :

Example 1 with IPostOffice

use of forestry.api.mail.IPostOffice 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();
}
Also used : ITradeStation(forestry.api.mail.ITradeStation) IMailAddress(forestry.api.mail.IMailAddress) IPostOffice(forestry.api.mail.IPostOffice) ITradeStationInfo(forestry.api.mail.ITradeStationInfo)

Example 2 with IPostOffice

use of forestry.api.mail.IPostOffice in project ForestryMC by ForestryMC.

the class PostRegistry method getPostOffice.

@Override
public IPostOffice getPostOffice(World world) {
    if (cachedPostOffice != null) {
        return cachedPostOffice;
    }
    PostOffice office = (PostOffice) world.loadData(PostOffice.class, PostOffice.SAVE_NAME);
    // Create office if there is none yet
    if (office == null) {
        office = new PostOffice();
        world.setData(PostOffice.SAVE_NAME, office);
    }
    office.setWorld(world);
    cachedPostOffice = office;
    return office;
}
Also used : IPostOffice(forestry.api.mail.IPostOffice)

Aggregations

IPostOffice (forestry.api.mail.IPostOffice)2 IMailAddress (forestry.api.mail.IMailAddress)1 ITradeStation (forestry.api.mail.ITradeStation)1 ITradeStationInfo (forestry.api.mail.ITradeStationInfo)1