Package vazkii.botania.api.mana

Examples of vazkii.botania.api.mana.IManaItem


      if(item.isDead)
        continue;

      ItemStack stack = item.getEntityItem();
      if(stack != null && stack.getItem() instanceof IManaItem) {
        IManaItem mana = (IManaItem) stack.getItem();
        if(outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) {
          boolean didSomething = false;

          if(outputting) {
            if(canSpare) {
              if(getCurrentMana() > 0 && mana.getMana(stack) < mana.getMaxMana(stack))
                didSomething = true;

              int manaVal = Math.min(1000, Math.min(getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
              if(!worldObj.isRemote)
                mana.addMana(stack, manaVal);
              recieveMana(-manaVal);
            }
          } else {
            if(canAccept) {
              if(mana.getMana(stack) > 0 && !isFull())
                didSomething = true;

              int manaVal = Math.min(1000, Math.min(manaCap - getCurrentMana(), mana.getMana(stack)));
              if(!worldObj.isRemote)
                mana.addMana(stack, -manaVal);
              recieveMana(manaVal);
            }
          }

          if(didSomething) {
View Full Code Here


          for(ItemStack stack : stacks) {
            if(stack == null || !(stack.getItem() instanceof IManaItem))
              continue;

            IManaItem manaItem = (IManaItem) stack.getItem();
            if(manaItem.canReceiveManaFromItem(stack, input)) {
              Map receivingStacks;
              boolean add = false;
              if(!receivingPlayers.containsKey(player)) {
                add = true;
                receivingStacks = new HashMap();
              } else receivingStacks = receivingPlayers.get(player);

              int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(TRANSFER_RATE, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
              if(recv > 0) {
                receivingStacks.put(stack, recv);
                if(add)
                  receivingPlayers.put(player, receivingStacks);
              }
View Full Code Here

TOP

Related Classes of vazkii.botania.api.mana.IManaItem

Copyright © 2018 www.massapicom. 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.