Search in sources :

Example 6 with IMailAddress

use of forestry.api.mail.IMailAddress 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 IMailAddress

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

the class GuiLetter method initGui.

@Override
public void initGui() {
    super.initGui();
    Keyboard.enableRepeatEvents(true);
    address = new GuiTextField(0, this.fontRenderer, guiLeft + 46, guiTop + 13, 93, 13);
    IMailAddress recipient = container.getRecipient();
    if (recipient != null) {
        address.setText(recipient.getName());
    }
    text = new GuiTextBox(1, this.fontRenderer, guiLeft + 17, guiTop + 31, 122, 57);
    text.setMaxStringLength(128);
    if (!container.getText().isEmpty()) {
        text.setText(container.getText());
    }
}
Also used : IMailAddress(forestry.api.mail.IMailAddress) GuiTextBox(forestry.core.gui.GuiTextBox) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 8 with IMailAddress

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

the class TileTrader method handleSetAddressRequest.

public void handleSetAddressRequest(String addressName) {
    IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
    setAddress(address);
    IMailAddress newAddress = getAddress();
    String newAddressName = newAddress.getName();
    if (newAddressName.equals(addressName)) {
        PacketTraderAddressResponse packetResponse = new PacketTraderAddressResponse(this, addressName);
        NetworkUtil.sendNetworkPacket(packetResponse, pos, world);
    }
}
Also used : IMailAddress(forestry.api.mail.IMailAddress) PacketTraderAddressResponse(forestry.mail.network.packets.PacketTraderAddressResponse)

Example 9 with IMailAddress

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

the class TileTrader method handleSetAddressResponse.

@SideOnly(Side.CLIENT)
public void handleSetAddressResponse(String addressName) {
    IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
    setAddress(address);
}
Also used : IMailAddress(forestry.api.mail.IMailAddress) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IMailAddress (forestry.api.mail.IMailAddress)9 ILetter (forestry.api.mail.ILetter)3 IPostalState (forestry.api.mail.IPostalState)2 EnumPostage (forestry.api.mail.EnumPostage)1 IPostOffice (forestry.api.mail.IPostOffice)1 IPostalCarrier (forestry.api.mail.IPostalCarrier)1 ITradeStation (forestry.api.mail.ITradeStation)1 ITradeStationInfo (forestry.api.mail.ITradeStationInfo)1 GuiTextBox (forestry.core.gui.GuiTextBox)1 EnumStampDefinition (forestry.mail.items.EnumStampDefinition)1 PacketLetterInfoResponse (forestry.mail.network.packets.PacketLetterInfoResponse)1 PacketPOBoxInfoResponse (forestry.mail.network.packets.PacketPOBoxInfoResponse)1 PacketTraderAddressResponse (forestry.mail.network.packets.PacketTraderAddressResponse)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1