Examples of IPostalState


Examples of forestry.api.mail.IPostalState

    ItemStack held = player.getCurrentEquippedItem();

    // Handle letter sending
    if (PostManager.postRegistry.isLetter(held)) {
      IPostalState result = this.tryDispatchLetter(held, true);
      if (!result.isOk())
        player.addChatMessage(new ChatComponentTranslation("for.chat.mail." + result.getIdentifier()));
      else
        held.stackSize--;
    } else
      player.openGui(ForestryAPI.instance, GuiId.MailboxGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord);
  }
View Full Code Here

Examples of forestry.api.mail.IPostalState

    return PostRegistry.getOrCreatePOBox(worldObj, address);
  }

  private IPostalState tryDispatchLetter(ItemStack letterstack, boolean dispatchLetter) {
    ILetter letter = PostManager.postRegistry.getLetter(letterstack);
    IPostalState result;

    if (letter != null)
      result = PostManager.postRegistry.getPostOffice(worldObj).lodgeLetter(worldObj, letterstack, dispatchLetter);
    else
      result = EnumDeliveryState.NOT_MAILABLE;
View Full Code Here

Examples of forestry.api.mail.IPostalState

  @Override
  public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
    if (!PostManager.postRegistry.isLetter(stack))
      return 0;

    IPostalState result = tryDispatchLetter(stack, doAdd);

    if (!result.isOk())
      return 0;
    else
      return 1;
  }
View Full Code Here

Examples of forestry.api.mail.IPostalState

    mail.writeToNBT(nbttagcompound);

    ItemStack mailstack = ForestryItem.letters.getItemStack(1, ItemLetter.encodeMeta(1, ItemLetter.getType(mail)));
    mailstack.setTagCompound(nbttagcompound);

    IPostalState responseState = PostManager.postRegistry.getPostOffice(world).lodgeLetter(world, mailstack, doLodge);
   
    if (!responseState.isOk()) {
      return EnumDeliveryState.RESPONSE_NOT_MAILABLE;
    }

    // Store received items
    for (int i = 0; i < ordersToFill; i++) {
View Full Code Here

Examples of forestry.api.mail.IPostalState

      return EnumDeliveryState.NOT_POSTPAID;

    if (!letter.isMailable())
      return EnumDeliveryState.NOT_MAILABLE;

    IPostalState state = EnumDeliveryState.NOT_MAILABLE;
    for (IMailAddress address : letter.getRecipients()) {
      IPostalCarrier carrier = PostManager.postRegistry.getCarrier(address.getType());
      if (carrier == null)
        continue;
      state = carrier.deliverLetter(world, this, address, itemstack, doLodge);
      if (!state.isOk())
        break;
    }

    if (!state.isOk())
      return state;

    collectPostage(letter.getPostage());

    markDirty();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.