Package vazkii.botania.api.mana

Examples of vazkii.botania.api.mana.IManaPool


    return true;
  }

  @Override
  public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
    IManaPool pool = getManaPool(par1ItemStack);
    if(!(pool instanceof DummyPool)) {
      if(pool == null) {
        bindPool(par1ItemStack, null);
        setManaForDisplay(par1ItemStack, 0);
      } else setManaForDisplay(par1ItemStack, pool.getCurrentMana());
    }
  }
View Full Code Here


    return true;
  }

  @Override
  public int getMana(ItemStack stack) {
    IManaPool pool = getManaPool(stack);
    return pool == null ? 0 : pool.getCurrentMana();
  }
View Full Code Here

    return TilePool.MAX_MANA;
  }

  @Override
  public void addMana(ItemStack stack, int mana) {
    IManaPool pool = getManaPool(stack);
    if(pool != null) {
      pool.recieveMana(mana);
      TileEntity tile = (TileEntity) pool;
      tile.getWorldObj().func_147453_f(tile.xCoord, tile.yCoord, tile.zCoord, tile.getWorldObj().getBlock(tile.xCoord, tile.yCoord, tile.zCoord));
    }
  }
View Full Code Here

    boolean redstone = false;

    for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
      if(tileAt instanceof IManaPool) {
        IManaPool pool = (IManaPool) tileAt;
        if(pool != receiver) {
          if(pool instanceof IKeyLocked && !((IKeyLocked) pool).getOutputKey().equals(getInputKey()))
            continue;

          int manaInPool = pool.getCurrentMana();
          if(manaInPool > 0 && !isFull()) {
            int manaMissing = getMaxMana() - mana;
            int manaToRemove = Math.min(manaInPool, manaMissing);
            pool.recieveMana(-manaToRemove);
            recieveMana(manaToRemove);
          }
        }
      }
View Full Code Here

    super.onUpdate();

    linkPool();

    if(linkedPool != null) {
      IManaPool pool = (IManaPool) linkedPool;
      int manaInPool = pool.getCurrentMana();
      int manaMissing = getMaxMana() - mana;
      int manaToRemove = Math.min(manaMissing, manaInPool);
      pool.recieveMana(-manaToRemove);
      addMana(manaToRemove);
    }

    if(acceptsRedstone()) {
      redstoneSignal = 0;
View Full Code Here

            for(int j = -range; j < range + 1; j++)
              for(int k = - range; k < range + 1; k++) {
                TileEntity tile = item.worldObj.getTileEntity(x + i, y + j, z + k);

                if(tile instanceof IManaPool) {
                  IManaPool pool = (IManaPool) tile;

                  if(!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) {
                    pool.recieveMana(-MANA_PER_TICK);
                    item.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
                    incrementCraftingTime(item, time);
                    break getManaFromPools;
                  }
                }
View Full Code Here

TOP

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

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.