Search in sources :

Example 1 with PacketLetterInfoResponse

use of forestry.mail.network.packets.PacketLetterInfoResponse in project ForestryMC by ForestryMC.

the class ContainerCatalogue method detectAndSendChanges.

@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    if (needsSync) {
        for (IContainerListener crafter : listeners) {
            crafter.sendWindowProperty(this, 0, stationIndex);
            crafter.sendWindowProperty(this, 1, stations.size());
            crafter.sendWindowProperty(this, 2, currentFilter);
        }
        NetworkUtil.sendToPlayer(new PacketLetterInfoResponse(EnumAddressee.TRADER, currentTrade, null), player);
        needsSync = false;
    }
}
Also used : PacketLetterInfoResponse(forestry.mail.network.packets.PacketLetterInfoResponse) IContainerListener(net.minecraft.inventory.IContainerListener)

Example 2 with PacketLetterInfoResponse

use of forestry.mail.network.packets.PacketLetterInfoResponse in project ForestryMC by ForestryMC.

the class ContainerLetter method handleRequestLetterInfo.

public void handleRequestLetterInfo(EntityPlayer player, String recipientName, EnumAddressee type) {
    MinecraftServer server = player.getServer();
    if (server == null) {
        Log.error("Could not get server");
        return;
    }
    IMailAddress recipient = getRecipient(server, recipientName, type);
    getLetter().setRecipient(recipient);
    // Update the trading info
    if (recipient == null || recipient.getType() == EnumAddressee.TRADER) {
        updateTradeInfo(player.world, recipient);
    }
    // Update info on client
    NetworkUtil.sendToPlayer(new PacketLetterInfoResponse(type, tradeInfo, recipient), player);
}
Also used : IMailAddress(forestry.api.mail.IMailAddress) PacketLetterInfoResponse(forestry.mail.network.packets.PacketLetterInfoResponse) MinecraftServer(net.minecraft.server.MinecraftServer)

Aggregations

PacketLetterInfoResponse (forestry.mail.network.packets.PacketLetterInfoResponse)2 IMailAddress (forestry.api.mail.IMailAddress)1 IContainerListener (net.minecraft.inventory.IContainerListener)1 MinecraftServer (net.minecraft.server.MinecraftServer)1