Package vazkii.botania.common.block

Source Code of vazkii.botania.common.block.BlockManaDetector

/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Mar 10, 2014, 7:57:38 PM (GMT)]
*/
package vazkii.botania.common.block;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.mana.TileManaDetector;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;

public class BlockManaDetector extends BlockModContainer implements ILexiconable {

  IIcon[] icons;

  protected BlockManaDetector() {
    super(Material.rock);
    setHardness(2.0F);
    setResistance(10.0F);
    setStepSound(Block.soundTypeStone);
    setBlockName(LibBlockNames.MANA_DETECTOR);
  }

  @Override
  public void registerBlockIcons(IIconRegister par1IconRegister) {
    icons = new IIcon[2];
    for(int i = 0; i < icons.length; i++)
      icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
  }

  @Override
  public IIcon getIcon(int par1, int par2) {
    return icons[Math.min(icons.length - 1, par2)];
  }

  @Override
  public boolean canProvidePower() {
    return true;
  }

  @Override
  public int isProvidingWeakPower(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
    return par1iBlockAccess.getBlockMetadata(par2, par3, par4) != 0 ? 15 : 0;
  }

  @Override
  public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
    if(par7Entity != null && !(par7Entity instanceof IManaBurst))
      super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
  }

  @Override
  public TileEntity createNewTileEntity(World world, int meta) {
    return new TileManaDetector();
  }

  @Override
  public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
    return LexiconData.manaDetector;
  }

}
TOP

Related Classes of vazkii.botania.common.block.BlockManaDetector

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.