Search in sources :

Example 6 with ILetter

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

the class ContainerLetter method onContainerClosed.

@Override
public void onContainerClosed(EntityPlayer entityplayer) {
    if (!entityplayer.world.isRemote) {
        ILetter letter = inventory.getLetter();
        if (!letter.isProcessed()) {
            IMailAddress sender = PostManager.postRegistry.getMailAddress(entityplayer.getGameProfile());
            letter.setSender(sender);
        }
    }
    inventory.onLetterClosed();
    super.onContainerClosed(entityplayer);
}
Also used : IMailAddress(forestry.api.mail.IMailAddress) ILetter(forestry.api.mail.ILetter)

Example 7 with ILetter

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

the class TileMailbox method tryDispatchLetter.

private IPostalState tryDispatchLetter(ItemStack letterStack) {
    ILetter letter = PostManager.postRegistry.getLetter(letterStack);
    IPostalState result;
    if (letter != null) {
        result = PostManager.postRegistry.getPostOffice(world).lodgeLetter(world, letterStack, true);
    } else {
        result = EnumDeliveryState.NOT_MAILABLE;
    }
    return result;
}
Also used : IPostalState(forestry.api.mail.IPostalState) ILetter(forestry.api.mail.ILetter)

Aggregations

ILetter (forestry.api.mail.ILetter)7 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 IMailAddress (forestry.api.mail.IMailAddress)3 IPostalState (forestry.api.mail.IPostalState)3 EnumPostage (forestry.api.mail.EnumPostage)1 IPostalCarrier (forestry.api.mail.IPostalCarrier)1 Letter (forestry.mail.Letter)1 ContainerLetter (forestry.mail.gui.ContainerLetter)1 GuiLetter (forestry.mail.gui.GuiLetter)1 ItemInventoryLetter (forestry.mail.inventory.ItemInventoryLetter)1 EnumStampDefinition (forestry.mail.items.EnumStampDefinition)1 ItemStack (net.minecraft.item.ItemStack)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1