/**
* 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 @ [May 9, 2014, 10:55:17 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
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.TileForestEye;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockForestEye extends BlockModContainer implements ILexiconable {
IIcon[] icons;
public BlockForestEye() {
super(Material.iron);
setHardness(5.0F);
setResistance(10.0F);
setStepSound(soundTypeMetal);
setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F);
setBlockName(LibBlockNames.FOREST_EYE);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[6];
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, par1)];
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
TileForestEye eye = (TileForestEye) par1World.getTileEntity(par2, par3, par4);
return Math.min(15, Math.max(0, eye.entities - 1));
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileForestEye();
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.forestEye;
}
}