Override this method in your block class
Code:
@Override@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
this.blockIcon = reg.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
}
Use this to register your block
Code:
public static void registerBlock(Block block,String name) {
block.setBlockName(<modid>.toLowerCase()+':'+name);
GameRegistry.registerBlock(block, name);
}
The texture should then go in the assets/<modid>/textures/blocks folder, with the name you specified when registering the block: <name>.png
EDIT: if it's an item, just do the analogous, but for items.